I want to insert many records into MySQL,so I do as followings:
...
if(!mQuery.exec("LOAD DATA INFILE '"+fileName+"' INTO TABLE table1 FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\r\n'"))
{
return false;
}
...
...
QSqlQuery mQuery;
if(!mQuery.exec("LOAD DATA INFILE '"+fileName+"' INTO TABLE table1 FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\r\n'"))
{
QMessageBox::warning(0,"",mQuery.lastError().text());
return false;
}
...
To copy to clipboard, switch view to plain text mode
and there is no respones,that is, table1 has no recorders and there is no error.
But when I execute " LOAD DATA INFILE '"+fileName+"' INTO TABLE table1 FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\r\n'" " in cmd window,it is ok,why?
Bookmarks