What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 16570 |  Welcome, Guest!   Register  Login
 Home > Forums > VB.NET > Syntax error in UPDATE statement. ...
Andra_Ruslan

Syntax error in UPDATE statement.

Replies: 7 | Posted by: Andra_Ruslan on 9/28/2012 | Category: VB.NET Forums | Views: 300 | Status: [Member] | Points: 10  


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


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Jayakumars
Jayakumars  
Posted on: 9/28/2012 9:57:51 PM
Level: Bronze | Status: [Member] | Points: 25

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

Regards
Email Id: kumaraspcode2009@gmail.com

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

Hariinakoti
Hariinakoti  
Posted on: 9/28/2012 10:00:32 PM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Jayakumars
Jayakumars  
Posted on: 9/28/2012 10:01:38 PM
Level: Bronze | Status: [Member] | Points: 25

hi
Please mark as answer if it helpful to you.


Mark as Answer if its helpful to you

Regards
Email Id: kumaraspcode2009@gmail.com

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

Solijoseph
Solijoseph  
Posted on: 9/29/2012 7:15:38 AM
Level: Starter | Status: [Member] | Points: 25


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. | Reply | Alert Moderator 

Andra_Ruslan
Andra_Ruslan  
Posted on: 9/29/2012 7:13:08 PM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Andra_Ruslan
Andra_Ruslan  
Posted on: 9/29/2012 7:43:27 PM
Level: Starter | Status: [Member] | Points: 25

hi Jayakumars

thank you fixed, you have good eye

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

Jayakumars
Jayakumars  
Posted on: 9/29/2012 9:52:37 PM
Level: Bronze | Status: [Member] | Points: 25


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

Regards
Email Id: kumaraspcode2009@gmail.com

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

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 7:27:02 AM