0

here's my code and that the error whenever i would add something to database.
i hope someone can help thanks :)

 Dim dbDataReader As OleDb.OleDbDataReader = Nothing
        Dim sqlAdd As String = "INSERT INTO Guest VALUES ('" & txtName.Text & "', '" & txtGuestId.Text & "')"
        If performNonQuery(connectionString, sqlAdd) Then
            MessageBox.Show("Congratulation you are now a member.")
        Else
            MessageBox.Show("error in saving.")
        End If


        If IsNumeric(txtName) Then
            MessageBox.Show("That is INVALID Sir/Madam")
            txtName.Text = "LASTNAME, FIRSTNAME MI."

        End If
3
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by G_Waddell
0

As Jim says, you need to Explicitly tell SQL Server which columns you are inserting your data into. For example, say I had a table with two columns A and B both these SQL statements are valid:

INSERT INTO MYTable (A,B) VALUES (Value1, Value2)

INSERT INTO MYTable (B,A) VALUES(Value1, Value2)

So when the DB parses the statement, it does not know which columns you wish to use unless you tell it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.