Forum Moderators: open
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'ExecuteNonQuery' is not a member of 'System.Data.OleDb.OleDbConnection'.
Source Error:
Line 67: objCommand = New OleDbCommand(strUpdate, objConnection)
Line 68:
Line 69: objConnection.ExecuteNonQuery
Line 70:
Line 71: objConnection.Close
My codes:
Public Sub DataGrid_Update(Source As Object, E As DataGridCommandEventArgs)
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim updateProductName As TextBox = E.Item.Cells(2).Controls(0)
Dim updateUnitPrice As TextBox = E.Item.Cells(3).Controls(0)
Dim updateQuantity As TextBox = E.Item.Cells(4).Controls(0)
Dim strUpdate As String
Dim strConnect As String
strUpdate = "UPDATE products SET " & "ProductName = '" & updateProductName.Text & "', " & "UnitPrice = '" & updateUnitPrice.Text & "', Quantity = '" & updateQuantity.Text & "' WHERE ProductID = " & E.Item.Cells(1).Text
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnect += "Data Source=C:\inetpub\wwwroot\ASP.NET\db\sample.mdb;"
strConnect += "Persist Security Info = False"
objConnection = New OleDbConnection(strConnect)
objConnection.Open()
objCommand = New OleDbCommand(strUpdate, objConnection)
objConnection.ExecuteNonQuery
objConnection.Close
DataGrid1.EditItemIndex = -1
bind()
End Sub
anyone could help? i don't understand what's the error about?