How to add data to multiple tables in sqlite in c++?
Unsolved
General and Desktop
-
wrote on 10 Mar 2020, 07:43 last edited by ioanna 3 Oct 2020, 07:45
I am getting error by using this code
"No query unable to fetch row"I am trying to insert the data to two tables but 'qry2' is getting that error. I am using this to insert data, is this right?
QSqlQuery qry; QSqlQuery qry2; qry.prepare("INSERT INTO first(Source,Medium,Subject,'Date & Time received document','Date & Time RRO forwarded to HOO','ControlNo.') values('"+src+"','"+med+"','"+key+"','"+one+"','"+one+"','"+res+"')"); qry2.prepare("INSERT INTO second(Source,Medium,Subject,'Date & Time received document','Date & Time RRO forwarded to HOO','ControlNo.') values('"+src+"','"+med+"','"+key+"','"+one+"','"+one+"','"+res+"')");
Yes I am inserting the same data to both tables. Can you help me?
-
I am getting error by using this code
"No query unable to fetch row"I am trying to insert the data to two tables but 'qry2' is getting that error. I am using this to insert data, is this right?
QSqlQuery qry; QSqlQuery qry2; qry.prepare("INSERT INTO first(Source,Medium,Subject,'Date & Time received document','Date & Time RRO forwarded to HOO','ControlNo.') values('"+src+"','"+med+"','"+key+"','"+one+"','"+one+"','"+res+"')"); qry2.prepare("INSERT INTO second(Source,Medium,Subject,'Date & Time received document','Date & Time RRO forwarded to HOO','ControlNo.') values('"+src+"','"+med+"','"+key+"','"+one+"','"+one+"','"+res+"')");
Yes I am inserting the same data to both tables. Can you help me?
@ioanna Please show the whole code not only query preparation but also execution.
Also, what does prepare() return? -
wrote on 10 Mar 2020, 08:24 last edited byThis post is deleted!
-
@ioanna Please show the whole code not only query preparation but also execution.
Also, what does prepare() return?
1/4