M Makumbi Well-Known Member Licensed User Longtime User Dec 4, 2018 #1 i have written this small code my it does not update my table as i required i wanted the phone number to be update by the newphone and the code to also be updated to the new code but when i check i dont see any changes to my table please help Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" cursor1 =Starter.SQL1.ExecQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text))
i have written this small code my it does not update my table as i required i wanted the phone number to be update by the newphone and the code to also be updated to the new code but when i check i dont see any changes to my table please help Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" cursor1 =Starter.SQL1.ExecQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text))
Computersmith64 Well-Known Member Licensed User Longtime User Dec 4, 2018 #2 Makumbi said: i have written this small code my it does not update my table as i required i wanted the phone number to be update by the newphone and the code to also be updated to the new code but when i check i dont see any changes to my table please help Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" cursor1 =Starter.SQL1.ExecQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text)) Click to expand... Try: Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" Starter.SQL1.ExecNonQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text)) An update query doesn't return a result. You only need to use a cursor where you are returning records as a result of your query. You can't do an update & return records at the same time (actually you could, but you'd need to use a stored procedure). - Colin. Last edited: Dec 4, 2018 Upvote 0
Makumbi said: i have written this small code my it does not update my table as i required i wanted the phone number to be update by the newphone and the code to also be updated to the new code but when i check i dont see any changes to my table please help Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" cursor1 =Starter.SQL1.ExecQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text)) Click to expand... Try: Code: Dim sqlString As String sqlString ="UPDATE Register SET Phone = ?, code = ? Where Phone = ? AND code = ?" Starter.SQL1.ExecNonQuery2(sqlString ,Array As String(Newnumber.Text, Codenewn.Text,Oldn.Text,Codeolda.Text)) An update query doesn't return a result. You only need to use a cursor where you are returning records as a result of your query. You can't do an update & return records at the same time (actually you could, but you'd need to use a stored procedure). - Colin.
KMatle Expert Licensed User Longtime User Dec 5, 2018 #3 Check it with "affected rows" -> Google Upvote 0