Free for PREMIUM members
[Webinar] Streamline your web hosting managementRegister Today
Public Sub Update_Row()
drCust.Item("CustomerID") = txtCustomerID.Text
drCust.Item("CompanyName") = txtCompanyName.Text
drCust.Item("ContactName") = txtContactName.Text
AddHandler dsNorthwind.Tables("Customers").RowChanging, _
RemoveHandler dsNorthwind.Tables("Customers").RowChanging, _
Open in new window
Private Sub Customer_RowChanging(ByVal sender As Object, _
ByVal e As System.Data.DataRowChangeEventArgs)
'*** Data verification throw exception is invalid
Dim strErrors As String
If txtCustomerID.Text = "" Then
strErrors = "CustomerID Req."
ElseIf txtCompanyName.Text = "" Then
strErrors = "Name Req."
If strErrors <> "" Then
Throw New System.Exception(strErrors)
Your question, your audience. Choose who sees your identity—and your question—with question security.
'' Insert your connection string in the below line of code.
Dim sqlConnection1 As New SqlConnection("Your connection string goes here")
Dim cmd As New SqlCommand
cmd.CommandType = System.Data.CommandType.Text
'' This your SQL Insert command. Make sure that all column names are spelled the same way as in the database
'' Change Buildings to your Table Name, the next list of comma separated names are the column names.
'' The next list of comma separated VALUES are the values to be inserted into the columns in the same order and
'' data types, strings have double quotes around it numeric values do not.
cmd.CommandText = "INSERT INTO Buildings (LOC_ID, BLDG_CODE, ROOM, CAPACITY) VALUES (15, 'NorthWestern', 209, 50)"
cmd.Connection = sqlConnection1
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $159.20.
Premium members get this course for $79.20.
Premium members get this course for $62.50.
Premium members get this course for $87.50.
Premium members get this course for $168.80.