Hi I've ran into this error and have been looking at it for about an hour now and can't get it fixed.

 cmd.CommandText = "INSERT INTO Appointments (ClientName, Period, Time, Treatment, Stylist) VALUES (@cName, @cDate, @cTime, @cTreat, @cStylist)";
                    cmd.CommandType = CommandType.Text;

                    cmd.Parameters.AddWithValue("@cName", txtCName.Text);
                    cmd.Parameters.AddWithValue("@cDate", txtDate.Text);
                    cmd.Parameters.AddWithValue("@cTime", DDLTime.SelectedValue);
                    cmd.Parameters.AddWithValue("@cTreat", DDLTreat.SelectedValue);
                    cmd.Parameters.AddWithValue("@cStylist", DDLstylist.SelectedValue);

                    conn.Open();
                    cmd.ExecuteNonQuery();

Can anyone see any errors in the code to result in the syntax error.

Thanks in advance

Is this different from this ?

If not, what's the error?

Yea this is a different error. When I run the page in debug it stops at line 11 with syntax error in INSERT INTO.

When I run the page in a browser, fill out the form and hit the submit button it doesn't do anything. So I placed a breakpoint on the button method so that when I run the application through debug it stops at the method and I can step through it, when I do this I can step through the code until it reaches cmd.ExecuteNonQuery(); It then comes up saying OleDbException was unhandled by user code, syntax error in INSERT INTO statement.

Query looks fine, perhaps one of the parameters is not set correctly.

hey..

try this:

VB

Dim transaction As SqlTransaction = Nothing

conn.Open()
transaction = conn.BeginTransaction()

Dim cmd As New SqlCommand("your insert statement", conn)


''set your parameters here...


cmd.Transaction = transaction
            cmd.Prepare()
            cmdExecuteNonQuery()
            transaction.Commit()

cheak datatype of colomn of your table and convert parameter type equal to that.