Help with Access and Visual Basic Insert statement
Posted on 2007-04-01
I am trying to insert data into a access database using textboxes and check boxes from a visual basic written form. Here is my query. I keep getting errors / not inserting at all into the database. Can someone help me. ps all the textbox names are correct.
Dim sqlInventoryString As String = "INSERT INTO Inventory (ID, First Name, Last Name, Description, Order Placed, Order Shipped, Order Received, Comments) values("",txtfirstname.text, txtlastname.text, txtdescription.text,checkboxorderplaced.checked, checkboxordershipped.checked, checkboxorderreceived.check, richtxtcomments.text);"
Dim sqlCommand As New OleDb.OleDbCommand(sqlInventoryString, logInOleDbConnection)
' Open the database connection.
' Run the sqlCommand.
Dim countFound As Integer = CType(sqlCommand.ExecuteScalar, Integer)
' Close the database connection.
' If countFound = 1 a record with a matching UserName and Password
' was found..
If countFound = 1 Then
Label13.Text = "Error Found Please Retry"