ucmd.CommandText = "UPDATE myDatabase level = '" & TextBox1.Text & "' ,area='" & TextBox2.Text & "' WHERE id='" & Label14.Text()
ucmd.CommandType = CommandType.Text
ucmd.Connection = cn2
ucmd.ExecuteNonQuery() <---------------------------has been highlight in yellow(error)
MsgBox(TextBox1.Text = "Record updated.")
Else
MsgBox("Enter the required values:")
(sorry for my bad english)
hallo to all..
i am new comer for vb.net....i am doing some basic programming..so far i can do for SELECT query, however for UPDATE these some mistake arise..the error appear seem like "Syntax error in string in query expression 'id='10'"
thank you for ur time =)
full code
Private Sub calculateArea_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn2.ConnectionString = strConnectionString2
cn2.Open()
If Label14.Text <> "" Then
ucmd.CommandText = "UPDATE myDatabase SET level= '" & TextBox1.Text & "' ,area='" & TextBox2.Text & "' WHERE id='" & Label14.Text()
'MsgBox(cmdUpdate.CommandText)
ucmd.CommandType = CommandType.Text
ucmd.Connection = cn2
ucmd.ExecuteNonQuery()
MsgBox(TextBox1.Text = "Record updated.")
Else
MsgBox("Enter the required values:")
End If
ucmd.Dispose()
End Sub

New Topic/Question
Reply




MultiQuote





|