G
Guest
Hello All!
I'm coding my UPDATE button on my data grid. Getting a syntax error, can't
seen to find it. Hope you can help
Thanks!!!
Rudy
Public Sub grdProducts_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
grdProducts.UpdateCommand
Dim Sqlconnection1 As New SqlConnection(SQL_CONNECTION_STRING)
Dim cmdProd As SqlCommand
Dim txtProductName As String = e.Item.Cells(1).Text
Dim txtSupplier As String = e.Item.Cells(2).Text
Dim txtCost As String = e.Item.Cells(4).Text
Dim txtSRP As String = e.Item.Cells(5).Text
Dim txtInStock As String = e.Item.Cells(3).Text
Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _
"ProductName = ' " & txtProductName & " ', " & _
"Supplier = ' " & txtSupplier & " ', " & _
"Cost = ' " & txtCost & " ', " & _
"SRP = ' " & txtSRP & " ', " & _
"InStock = ' " & txtInStock & " ', " & _
"WHERE ProductID = ' " & e.Item.Cells(0).Text & " '"
Sqlconnection1 = New
SqlConnection(ConfigurationSettings.AppSettings("ConnString"))
cmdProd = New SqlCommand(strUpdate, Sqlconnection1)
SqlConnection1.Open()
cmdProd.ExecuteNonQuery()
grdProducts.EditItemIndex = -1
BindProductsGrid()
End Sub
I'm coding my UPDATE button on my data grid. Getting a syntax error, can't
seen to find it. Hope you can help
Thanks!!!
Rudy
Public Sub grdProducts_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
grdProducts.UpdateCommand
Dim Sqlconnection1 As New SqlConnection(SQL_CONNECTION_STRING)
Dim cmdProd As SqlCommand
Dim txtProductName As String = e.Item.Cells(1).Text
Dim txtSupplier As String = e.Item.Cells(2).Text
Dim txtCost As String = e.Item.Cells(4).Text
Dim txtSRP As String = e.Item.Cells(5).Text
Dim txtInStock As String = e.Item.Cells(3).Text
Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _
"ProductName = ' " & txtProductName & " ', " & _
"Supplier = ' " & txtSupplier & " ', " & _
"Cost = ' " & txtCost & " ', " & _
"SRP = ' " & txtSRP & " ', " & _
"InStock = ' " & txtInStock & " ', " & _
"WHERE ProductID = ' " & e.Item.Cells(0).Text & " '"
Sqlconnection1 = New
SqlConnection(ConfigurationSettings.AppSettings("ConnString"))
cmdProd = New SqlCommand(strUpdate, Sqlconnection1)
SqlConnection1.Open()
cmdProd.ExecuteNonQuery()
grdProducts.EditItemIndex = -1
BindProductsGrid()
End Sub