I just keep getting the same error. can not insert record. Problem near keyword "where".
Imports System.Security
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Data
Partial Class admin
Inherits System.Web.UI.Page
Public connectPath As String = ConfigurationSettings.AppSettings("Maya")
Protected Sub fillDropList(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
DropList1.DataSource = Membership.GetAllUsers()
DropList1.DataBind()
End If
End Sub
Protected Sub DropList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropList1.SelectedIndexChanged
Dim theUser2 As Integer = names.SelectedDataKey.Value
Dim con As New SqlConnection
con.ConnectionString = connectPath
'the customerID of the selected gridview row
Dim setRep As New SqlCommand
setRep.Connection = con
setRep.CommandText = "INSERT INTO dbo.customers(rep)VALUES(@dropList1)WHERE customerID = @ID"
setRep.Parameters.AddWithValue("@dropList1", DropList1.SelectedItem.ToString())
setRep.Parameters.AddWithValue("@ID", gridView1.SelectedDataKey.Value)
Dim added As Integer = 0
Try
con.Open()
added = setRep.ExecuteNonQuery()
results.Text = added.ToString() & "record has been added!"
Catch Err As Exception
results.Text = "Error inserting record. "
results.Text &= Err.Message
Finally
con.Close()
End Try
End Sub
End Class