我通过 selectall 查询从 db 获取结果,我想将结果保存在数组中并通过套接字发送。
db.open();
QSqlQuery *selectall = new QSqlQuery(db);
selectall->prepare("select * from phone_table");
selectall->exec();
selectall->first();
QString result;
QByteArray arrayresult;
int index = 0;
while (selectall->next())
{
index += 1;
// qint16 id = selectall->value(0).toString();
QString name_ = selectall->value(1).toString();
QString surname = selectall->value(2).toString();
QString phone_number = selectall->value(3).toString();
result = "*"+ name_+"*"+surname+"*"+phone_number;
arrayresult[index] = result;
}
我收到此错误二进制“=”:未找到采用“const char [16]”类型的右侧操作数的运算符