hi guys ive the following sub which updates a mysql table... i call when a button is pressed to move all the data listed in the listview to be transferred from one table to another... now when i run this, while debugging i found that the first query gets executed and it returns back to continue the rest of the code in the commandbutton instead of executing the second query and then looping in the for next loop... please guide me on the issue.. hope im clear enough in explaining it...
cnmarket is the adodb connection....
Code:Public Sub updatetable() Dim strquery2 As String Call OpenDatabase Set rsQuery = New ADODB.Recordset Dim strQuery As String Dim tbname As String tbname = GetSetting(App.EXEName, "table", "name", "http_jobs") For i = 1 To ListView1.ListItems.Count strQuery = "INSERT INTO `testtable` SELECT * FROM `" & tbname & "` WHERE `id`='" & ListView1.ListItems(i).Text & "' LIMIT 1;" strquery2 = "Delete * FROM `" & tbname & "` WHERE `id`='" & ListView1.ListItems(i).Text & "' LIMIT 1;" cnMarket.Execute (strQuery) 'EXECUTED cnMarket.Execute (strquery2) 'DOESNT REACH HERE,JUMPS BACK... Next i End Sub




Reply With Quote