Hi everyone
I have written the following code to update values in my database. I am using a
VB front end but when i run execute the command nothing happens. Can anyone advise me on where i am going wrong. Please rewrite my code if you can. I will be so greatful.Look forward to hearing from you.
'connect to database
mySqlCommand.Connection = myConnection
mySqlCommand.CommandType = CommandType.Text
mySqlCommand.CommandText = " UPDATE AIRLINE_BOOKING" & _
"SET RESERVENO=@RESERVENO_UP,TELEPHONE=@TELEPHONE_UP,ST ARTAIRPORT=@STARTAIRPORT_UP," & _
"TRAVELDATE=@TRAVELDATE_UP,DEPARTTIME=@DEPARTTIME_U P,A_DESCRIPTION=@A_DESCRIPTION_UP," & _
"A_BOOKDATE=@A_BOOKDATE_UP,A_HELDUNTIL=@A_HELDUNTIL _UP,A_BASICCOST=@A_BASICCOST_UP," & _
" A_DEPOSIT=@A_DEPOSIT_UP " & _
" WHERE AIRLINEID=@AIRLINEID_UP"
'add the parameters
mySqlCommand.Parameters.AddWithValue("@AIRLINE_NAM E_UP", ANAME.Text)
mySqlCommand.Parameters.AddWithValue("@RESERVENO_U P", ARESNO.Text)
mySqlCommand.Parameters.AddWithValue("@TELEPHONE_U P", ATELEPHONE.Text)
mySqlCommand.Parameters.AddWithValue("@STARTAIRPOR T_UP", ASTARTAIRPORT.Text)
mySqlCommand.Parameters.AddWithValue("@TRAVELDATE_ UP", ATRAVELDATE.Text).DbType = DbType.Date
mySqlCommand.Parameters.AddWithValue("@DEPARTTIME_ UP", ADEPTIME.Text)
mySqlCommand.Parameters.AddWithValue("@A_DESCRIPTI ON_UP", ADESCRIPTION.Text)
mySqlCommand.Parameters.AddWithValue("@A_BOOKDATE_ UP", ABOOKDATE.Text).DbType = DbType.Date
mySqlCommand.Parameters.AddWithValue("@A_HELDUNTIL _UP", AHELDUNTIL.Text).DbType = DbType.Date
mySqlCommand.Parameters.AddWithValue("@A_BASICCOST _UP", ABASICCOST.Text)
mySqlCommand.Parameters.AddWithValue("@A_DEPOSIT_U P", ADEPOSIT.Text)
mySqlCommand.Parameters.AddWithValue("@AIRLINEID_U P", BindingContext(myDataView).Current("AIRLINEID"))
'OPEN CONNECTION
myConnection.Open()
Try
mySqlCommand.ExecuteNonQuery()
Catch MYERRORCHECKER As SqlException
MessageBox.Show(MYERRORCHECKER.Message)
End Try
myConnection.Close()