Syntax error in UPDATE statement.

Posted by Andra_Ruslan under VB.NET on 9/28/2012 | Points: 10 | Views : 1261 | Status : [Member] | Replies : 7
can any on help me for below update statement. and tell me where the mistake

Private Sub update_prosedure()
connection = New OleDbConnection(connetionString)
Dim cmd As New OleDb.OleDbCommand

' If Not connection.State = ConnectionState.Open Then
' connection.Open()
' End If

cmd.Connection = connection

Dim a As String = "UPDATE material Set ([NOREG]=@NOREG], [DATE]=[@DATE], [SUPPLIER]=[@SUPPLIER], [NOSJL]=[@NOSJL], [PO]=[@PO], [STYLE]=[@STYLE], [DESCRIPTION]=[@descrip], [COLOR]=[@COLOR], [SIZE]=[@SIZE], [QTY]=[@QTY], [UOM]=[@UOM], [NOCSTMBN]=[@NOCSTMBN]) WHERE [NOREG]=[@NOREG]"
With cmd.Parameters
.AddWithValue("@NOREG", txt_noreg.Text)
.AddWithValue("@DATE", txt_date.Text)
.AddWithValue("@SUPPLIER", txt_supplier.Text)
.AddWithValue("@NOSJL", txt_nosjl.Text)
.AddWithValue("@PO", txt_po.Text)
.AddWithValue("@STYLE", txt_style.Text)
.AddWithValue("@descrip", txt_descrip.Text)
.AddWithValue("@COLOR", txt_color.Text)
.AddWithValue("@SIZE", txt_size.Text)
.AddWithValue("@QTY", txt_qty.Text)
.AddWithValue("@UOM", cmb_uom.Text)
.AddWithValue("@NOCSTMBN", txt_nocstmbn.Text)
End With
connection.Open()
cmd.CommandText = a
' cmd = New OleDbCommand(a, connection)
cmd.ExecuteNonQuery()

ref_table()
connection.Close()
clear()

End Sub




Responses

Posted by: Jayakumars on: 9/28/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
which error face for this can you explain.
check your parameter value correct or not then date field check them then
check also update this [NOREG]=@NOREG] riht or not check them.

Mark as Answer if its helpful to you

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/28/2012 [Member] Starter | Points: 25

Up
0
Down
What is that syntax error and where u got?
can u explain

Thanks & Regards
Hari

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/28/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer if it helpful to you.


Mark as Answer if its helpful to you

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Solijoseph on: 9/29/2012 [Member] Starter | Points: 25

Up
0
Down

Dim a As String = "UPDATE material Set ([NOREG]=@NOREG],......... rewirite as ([NOREG]=[@NOREG],..........

Thanks & Regards
Solimon Joseph

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Andra_Ruslan on: 9/29/2012 [Member] Starter | Points: 25

Up
0
Down
hi Hariinakoti

"Syntax error in UPDATE statement." i got this error. the procedure is for update database

hi Solijoseph

i try , but not working

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Andra_Ruslan on: 9/29/2012 [Member] Starter | Points: 25

Up
0
Down
hi Jayakumars

thank you fixed, you have good eye

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/29/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down

hi
Andra_Ruslan
your issue solved means

Donot Forgot
Please mark as resolved answer if it helpful to you.


Mark as Answer if its helpful to you

Andra_Ruslan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response