philwes83170
MIS
I'm stuck. I've been trying to get this to work all day and can't seem to find the problem. I am trying to insert a row into an Access table with data from an asp.net page.
I have two drop-down lists and three text boxes on the page that the user will input data to. I generate a primary key off the count of the records to get the sixth value.
When I try to run the ExecuteNonQuery command I always get an error message saying "Syntax Error in SELECT INTO". Here is the code I'm using
Dim cmdStr As String = "INSERT INTO tblStats (StatID, WpnID, Min, Max, Spd, CreatorID) VALUES ('" & strStatKey & "','" & ddAddWpn.SelectedValue & "'," & CInt(txtAddMin.Text) & "," & CInt(txtAddMax.Text) & "," & CDbl(txtAddSpd.Text) & ",'" & ddAddCreator.SelectedValue & "')"
Dim cmdInsert As New OleDbCommand(cmdStr, OleDbConnection1)
OleDbConnection1.Open()
intAffected = cmdInsert.ExecuteNonQuery()
OleDbConnection1.Close()
MessageBox.Show("Number Affected: " & intAffected)
Thanks in advance...
I have two drop-down lists and three text boxes on the page that the user will input data to. I generate a primary key off the count of the records to get the sixth value.
When I try to run the ExecuteNonQuery command I always get an error message saying "Syntax Error in SELECT INTO". Here is the code I'm using
Dim cmdStr As String = "INSERT INTO tblStats (StatID, WpnID, Min, Max, Spd, CreatorID) VALUES ('" & strStatKey & "','" & ddAddWpn.SelectedValue & "'," & CInt(txtAddMin.Text) & "," & CInt(txtAddMax.Text) & "," & CDbl(txtAddSpd.Text) & ",'" & ddAddCreator.SelectedValue & "')"
Dim cmdInsert As New OleDbCommand(cmdStr, OleDbConnection1)
OleDbConnection1.Open()
intAffected = cmdInsert.ExecuteNonQuery()
OleDbConnection1.Close()
MessageBox.Show("Number Affected: " & intAffected)
Thanks in advance...