Hi was wondering if anyone could take a look at my code and see whats going wrong here because I have changed the code about 20 times trying to fix the error and still no luck.

I have created a web page that the user must fill out, I then want to save this data to a ms database I have attached to visual studios project.

This is my code behind

 string ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\IFMComac\\Documents\\Visual Studio 2013\\ifm.mdb.accdb";
            OleDbConnection conn = new OleDbConnection(ConnectionString);
            OleDbCommand cmd = new OleDbCommand("INSERT INTO tblCheck (CheckID,Vehicle,Driver,Date,FuelLevel,WindscreenWasher,SteeringWheel,Brakes,Clutch,Horn,Heater,SeatBelts,WarningLights,Mirrors,Tires/Wheels,Exhaust,Lights/Reflectors,ExteriorLeaks,Body,OilLevel,CoolantLevel,Belts,EngineLeaks,LooseBolts/Screws,WarningTriangle,FireExtinguishers/FirstAidKit,Defects,AdditionalComments,CFirstName,CLastName) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",conn);

            cmd.Parameters.AddWithValue(@"CheckID", OleDbType.VarChar).Value = txtID.Text;
            cmd.Parameters.AddWithValue(@"Vehicle", OleDbType.VarChar).Value = ddlReg.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Driver", OleDbType.VarChar).Value = ddlDrive.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Date", OleDbType.Date).Value = cldDate0.SelectedDate;
            cmd.Parameters.AddWithValue(@"FuelLevel", OleDbType.VarChar).Value = cblFuel.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WindscreenWasher", OleDbType.VarChar).Value = cblWash.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"SteeringWheel", OleDbType.VarChar).Value = cblWheel.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Brakes", OleDbType.VarChar).Value = cblBrake.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Clutch", OleDbType.VarChar).Value = cblClutch.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Horn", OleDbType.VarChar).Value = cblHorn.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Heater", OleDbType.VarChar).Value = cblHeat.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"SeatBelts", OleDbType.VarChar).Value = cblSBelt.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WarningLights", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Mirrors", OleDbType.VarChar).Value = cblMirror.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Tires/Wheels", OleDbType.VarChar).Value = cblTire.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Exhaust", OleDbType.VarChar).Value = cblExhaust.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Lights/Reflectors", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"ExteriorLeaks", OleDbType.VarChar).Value = cblExLeaks.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Body", OleDbType.VarChar).Value = cblBody.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"OilLevel", OleDbType.VarChar).Value = cblOil.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"CoolantLevel", OleDbType.VarChar).Value = cblCool.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Belts", OleDbType.VarChar).Value = cblBelt.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"EngineLeaks", OleDbType.VarChar).Value = cblEnLeak.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"LooseBolts/Screws", OleDbType.VarChar).Value = cblScrew.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WarningTriangle", OleDbType.VarChar).Value = cblWTri.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"FireExtinguisher/FirstAidKit", OleDbType.VarChar).Value = cblFire.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Defects", OleDbType.VarChar).Value = txtDefect.Text;
            cmd.Parameters.AddWithValue(@"AdditionalComments", OleDbType.VarChar).Value = txtAddCom.Text;
            cmd.Parameters.AddWithValue(@"CFirstName", OleDbType.VarChar).Value = txtFirstName.Text;
            cmd.Parameters.AddWithValue(@"CLastName", OleDbType.VarChar).Value = txtLastName.Text;

            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();
            cmd.Dispose();

        }

Before I was having a problem with my checkboxlist it was saying failed to convert list item to string, but I think thats sorted now.
But I keep getting this same error no matter which way I write this code.

Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

Source Error:

Line 124: //cmd.Parameters.Add(new OleDbParameter(@"CLastName", txtLastName));
Line 125: cmd.Connection.Open();
Line 126: cmd.ExecuteNonQuery();
Line 127: cmd.Connection.Close();
Line 128: cmd.Dispose();

Source File: c:\Users\IFMComac\Documents\Visual Studio 2013\Projects\IfmApp\WebApplication4\Checklist.aspx.cs Line: 126

Stack Trace:

[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1102900
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +189
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +162
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +107
WebApplication4.Checklist.cmdSave_Click(Object sender, EventArgs e) in c:\Users\IFMComac\Documents\Visual Studio 2013\Projects\IfmApp\WebApplication4\Checklist.aspx.cs:126
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Edited 2 Years Ago by mmm123

Here is an example

private static void Insert(String name, String lastName, int phone) {
    string cmdStr = "INSERT INTO Person (FirstName ,LastName ,Telephone) VALUES (@FirstName, @LastName, @Telephone)";
    using (SqlConnection connection = new SqlConnection(ConnectionString))
    using (SqlCommand command = new SqlCommand(cmdStr, connection)) {
        command.Parameters.AddWithValue("@FirstName", name);
        command.Parameters.AddWithValue("@LastName", lastName);
        command.Parameters.AddWithValue("@Telephone", phone);
        connection.Open();
        int affectedRows = command.ExecuteNonQuery();
        Console.WriteLine("Affected Rows: {0}", affectedRows);
    }
}

Edited 2 Years Ago by Michael27

I am not sure how to edit the question so here is my updated program but still facing the same error

string ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\IFMComac\\Documents\\Visual Studio 2013\\ifm.mdb.accdb";
            OleDbConnection conn = new OleDbConnection(ConnectionString);
            OleDbCommand cmd = new OleDbCommand("INSERT INTO tblCheck (CheckID,Vehicle,Driver,Date1,FuelLevel,WindscreenWasher,SteeringWheel,Brakes,Clutch,Horn,Heater,SeatBelts,WarningLights,Mirrors,[Tires/Wheels],Exhaust,[Lights/Reflectors],ExteriorLeaks,Body,OilLevel,CoolantLevel,Belts,EngineLeaks,[LooseBolts/Screws],WarningTriangle,[FireExtinguishers/FirstAidKit],Defects,AdditionalComments,CFirstName,CLastName) VALUES (@txtID, @ddlReg, @ddlDrive,  @cldDate0, @clFuel, @cblWash, @cblWheel, @cblBrake, @cblClutch, @cblHorn, @cblHeat, @cblHeat, @cblSBelt, @cblWLight, @cblMirror, @cblTire, @cblExhaust, @cblLights, @cblBody, @cblOil, @cblCool, @cblBelt, @cblBrake, @cblExLeaks, @cblEnLeaks, @cblClutch, @cblBody, @cblScrew, @cblHorn, @cblHeat, @cblSBelt, @cblWLight, @cblMirror, @txtDefect, @txtAddCom, @txtFristName, @txtLastName )", conn);

             cmd.Parameters.AddWithValue(@"CheckID", txtID.Text);
            cmd.Parameters.AddWithValue(@"Vehicle", ddlReg.Text);
            cmd.Parameters.AddWithValue(@"Driver", ddlDrive.Text);
            cmd.Parameters.AddWithValue(@"Date", cldDate0.SelectedDates);
            cmd.Parameters.AddWithValue(@"FuelLevel", cblFuel.Text);
            cmd.Parameters.AddWithValue(@"WindscreenWasher", cblWash.Text);
            cmd.Parameters.AddWithValue(@"SteeringWheel", cblWheel.Text);
            cmd.Parameters.AddWithValue(@"Brakes", cblBrake.Text);
            cmd.Parameters.AddWithValue(@"Clutch", cblClutch.Text);
            cmd.Parameters.AddWithValue(@"Horn", cblHorn.Text);
            cmd.Parameters.AddWithValue(@"Heater", cblHeat.Text);
            cmd.Parameters.AddWithValue(@"SeatBelts", cblSBelt.Text);
            cmd.Parameters.AddWithValue(@"WarningLights", cblWLight.Text);
            cmd.Parameters.AddWithValue(@"Mirrors", cblMirror.Text);
            cmd.Parameters.AddWithValue(@"[Tires/Wheels]", cblTire.Text);
            cmd.Parameters.AddWithValue(@"Exhaust", cblExhaust.Text);
            cmd.Parameters.AddWithValue(@"[Lights/Reflectors]", cblLights.Text);
            cmd.Parameters.AddWithValue(@"Exterior Leaks", cblExLeaks.Text);
            cmd.Parameters.AddWithValue(@"Body", cblBody.Text);
            cmd.Parameters.AddWithValue(@"OilLevel", cblOil.Text);
            cmd.Parameters.AddWithValue(@"CoolantLevel", cblCool.Text);
            cmd.Parameters.AddWithValue(@"Belts", cblBelt.Text);
            cmd.Parameters.AddWithValue(@"EngineLeaks", cblEnLeak.Text);
            cmd.Parameters.AddWithValue(@"[LooseBolts/Screws]", cblScrew.Text);
            cmd.Parameters.AddWithValue(@"WarningTriangle", cblWTri.Text);
            cmd.Parameters.AddWithValue(@"[FireExtinguisher/FirstAidKit]", cblFire.Text);
            cmd.Parameters.AddWithValue(@"Defects", txtDefect.Text);
            cmd.Parameters.AddWithValue(@"AdditionalComments", txtAddCom.Text);
            cmd.Parameters.AddWithValue(@"CFirstName", txtFirstName.Text);
            cmd.Parameters.AddWithValue(@"CLastName", txtLastName.Text);
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            cmd.Dispose();

and have tried these as well but still no luck

 cmd.Parameters.AddWithValue(@"CheckID", OleDbType.VarChar).Value = txtID.Text;
            cmd.Parameters.AddWithValue(@"Vehicle", OleDbType.VarChar).Value = ddlReg.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Driver", OleDbType.VarChar).Value = ddlDrive.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Date1", OleDbType.Date).Value = cldDate0.SelectedDate;
            cmd.Parameters.AddWithValue(@"FuelLevel", OleDbType.VarChar).Value = cblFuel.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WindscreenWasher", OleDbType.VarChar).Value = cblWash.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"SteeringWheel", OleDbType.VarChar).Value = cblWheel.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Brakes", OleDbType.VarChar).Value = cblBrake.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Clutch", OleDbType.VarChar).Value = cblClutch.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Horn", OleDbType.VarChar).Value = cblHorn.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Heater", OleDbType.VarChar).Value = cblHeat.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"SeatBelts", OleDbType.VarChar).Value = cblSBelt.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WarningLights", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Mirrors", OleDbType.VarChar).Value = cblMirror.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"[Tires/Wheels]", OleDbType.VarChar).Value = cblTire.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Exhaust", OleDbType.VarChar).Value = cblExhaust.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"[Lights/Reflectors]", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"ExteriorLeaks", OleDbType.VarChar).Value = cblExLeaks.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Body", OleDbType.VarChar).Value = cblBody.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"OilLevel", OleDbType.VarChar).Value = cblOil.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"CoolantLevel", OleDbType.VarChar).Value = cblCool.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Belts", OleDbType.VarChar).Value = cblBelt.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"EngineLeaks", OleDbType.VarChar).Value = cblEnLeak.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"[LooseBolts/Screws]", OleDbType.VarChar).Value = cblScrew.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"WarningTriangle", OleDbType.VarChar).Value = cblWTri.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"[FireExtinguisher/FirstAidKit]", OleDbType.VarChar).Value = cblFire.SelectedItem.Text;
            cmd.Parameters.AddWithValue(@"Defects", OleDbType.VarChar).Value = txtDefect.Text;
            cmd.Parameters.AddWithValue(@"AdditionalComments", OleDbType.VarChar).Value = txtAddCom.Text;
            cmd.Parameters.AddWithValue(@"CFirstName", OleDbType.VarChar).Value = txtFirstName.Text;
            cmd.Parameters.AddWithValue(@"CLastName", OleDbType.VarChar).Value = txtLastName.Text;

and

 @"INSERT INTO [tblCheck] (ChecklistID,Vehicle,Driver,[Date],FuelLevel,WindscreenWasher,SteeringWheel,Brakes,Clutch,Horn,Heater,SeatBelts,WarningLights,Mirrors,Tires/Wheels,Exhaust,Lights/Reflectors,ExteriorLeaks,Body,OilLevel,CoolantLevel,Belts,EngineLeaks,LooseBolts/Screws,WarningTriangle,FireExtinguishers/FirstAidKit,Defects,AdditionalComments,CFirstName,CLastName) Values (@txtID, @ddlDrive, @ddlReg, @cldDate0, @clFuel, @cblWash, @cblWheel, @cblBrake, @cblClutch, @cblHorn, @cblHeat, @cblHeat, @cblSBelt, @cblWLight, @cblMirror, @cblTire, @cblExhaust, @cblLights, @cblBody, @cblOil, @cblCool, @cblBelt, @cblBrake, @cblExLeaks, @cblEnLeaks, @cblClutch, @cblBody, @cblScrew, @cblHorn, @cblHeat, @cblSBelt, @cblWLight, @cblMirror, @txtDefect, @txtAddCom, @txtFristName, @txtLastName )";

  @"INSERT INTO tblCheck (ChecklistID,Vehicle,Driver,[Date],FuelLevel,WindscreenWasher,SteeringWheel,Brakes,Clutch,Horn,Heater,SeatBelts,WarningLights,Mirrors,Tires/Wheels,Exhaust,Lights/Reflectors,ExteriorLeaks,Body,OilLevel,CoolantLevel,Belts,EngineLeaks,LooseBolts/Screws,WarningTriangle,FireExtinguishers/FirstAidKit,Defects,AdditionalComments,CFirstName,CLastName) Values ('" + txtID + "', '" + ddlDrive + "', '" + ddlReg + "', '" + cldDate0 + "', '" + cblFuel + "', '" + cblWash + "', '" + cblWheel + "', '" + cblBrake + "', '" + cblClutch + "', '" + cblHorn + "', '" + cblHeat + "' , '" + cblSBelt + "', '" + cblWLight + "', '" + cblMirror + "', '" + cblTire + "', '" + cblExhaust + "', '" + cblLights + "', '" + cblBody + "', '" + cblOil + "', '" + cblCool + "', '" + cblBelt + "', '" + cblEnLeak + "', '" + cblScrew + "', '" + cblWTri + "', '" + cblFire + "', '" + txtDefect + "',  '" + txtAddCom + "', '" + txtFirstName + "', '" + txtLastName + "')");

By all means you should reduce your code. After reducing it try to insert some data, see if the connection is right. If you manage to insert data into the database then you wont have a problem with inserting more data into it(for testing purpose).
The best thing for us would be to copy and paste your code to VS. and see where does the problem pop out, but with a lot of code here, it is a time consuming activity...

I see that you've got a Lot of columns in Only one table. That is not good. Try to make more Entities(Tables) and then to every each one of them assign related attributes(Columns). By doing that your are Normalizing your database (Google:database normalization).

You are writing parameters as I saw in the code above in an incorrect syntax.
You wrote:

cmd.Parameters.AddWithValue(@"CheckID", txtID.Text);

You are writing the @ symbol outside the double quote while you have to put them within the double quote like this

cmd.Parameters.AddWithValue("@CheckID", txtID.Text);

because when you declare parameter within SQL you declare them this way

DECLARE @ParameterName DATATYPE

So when mapping within C# you have to write the parameter the same way you declared them within SQL

Edited 2 Years Ago by AmrMohammed

The problem is the 'Tires/Wheels' fields, unless those are two column names, it's not a valid column name. What you are telling it to do is divide the Tires column by the Wheels column.

The previous poster is incorrect as OLE doesn't care what you name them, it just takes them in order.

Edited 2 Years Ago by Momerath

            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\IFMComac\\Documents\\Visual Studio 2013\\ifm.mdb.accdb");
            OleDbCommand cmd = new OleDbCommand("INSERT INTO tblCheck (CheckID,Vehicle,Driver,Date,FuelLevel,WindscreenWasher,SteeringWheel,Brakes,Clutch,Horn,Heater,SeatBelts,WarningLights,Mirrors,[Tires/Wheels],Exhaust,[Lights/Reflectors],ExteriorLeaks,Body,OilLevel,CoolantLevel,Belts,EngineLeaks,[LooseBolts/Screws],WarningTriangle,[FireExtinguishers/FirstAidKit],Defects,AdditionalComments,CFirstName,CLastName) VALUES (@CheckID,@Vehicle,@Driver,@Date,@FuelLevel,@WindscreenWasher,@SteeringWheel,@Brakes,@Clutch,@Horn,@Heater,@SeatBelts,@WarningLights,@Mirrors,@Tires_Wheels,@Exhaust,@Lights_Reflectors,@ExteriorLeaks,@Body,@OilLevel,@CoolantLevel,@Belts,@EngineLeaks,@LooseBolts_Screws,@WarningTriangle,@FireExtinguishers_FirstAidKit,@Defects,@AdditionalComments,@CFirstName,@CLastName) ",conn);
            cmd.Parameters.Add("@CheckID", OleDbType.VarChar).Value = txtID.Text;
            cmd.Parameters.Add("@Vehicle", OleDbType.VarChar).Value = ddlReg.SelectedItem.Text;
            cmd.Parameters.Add("@Driver", OleDbType.VarChar).Value = ddlDrive.SelectedItem.Text;
            cmd.Parameters.Add("@Date", OleDbType.Date).Value = cldDate0.SelectedDate;
            cmd.Parameters.Add("@FuelLevel", OleDbType.VarChar).Value = cblFuel.SelectedItem.Text;
            cmd.Parameters.Add("@WindscreenWasher", OleDbType.VarChar).Value = cblWash.SelectedItem.Text;
            cmd.Parameters.Add("@SteeringWheel", OleDbType.VarChar).Value = cblWheel.SelectedItem.Text;
            cmd.Parameters.Add("@Brakes", OleDbType.VarChar).Value = cblBrake.SelectedItem.Text;
            cmd.Parameters.Add("@Clutch", OleDbType.VarChar).Value = cblClutch.SelectedItem.Text;
            cmd.Parameters.Add("@Horn", OleDbType.VarChar).Value = cblHorn.SelectedItem.Text;
            cmd.Parameters.Add("@Heater", OleDbType.VarChar).Value = cblHeat.SelectedItem.Text;
            cmd.Parameters.Add("@SeatBelts", OleDbType.VarChar).Value = cblSBelt.SelectedItem.Text;
            cmd.Parameters.Add("@WarningLights", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.Add("@Mirrors", OleDbType.VarChar).Value = cblMirror.SelectedItem.Text;
            cmd.Parameters.Add("@Tires_Wheels", OleDbType.VarChar).Value = cblTire.SelectedItem.Text;
            cmd.Parameters.Add("@Exhaust", OleDbType.VarChar).Value = cblExhaust.SelectedItem.Text;
            cmd.Parameters.Add("@Lights_Reflectors", OleDbType.VarChar).Value = cblWLight.SelectedItem.Text;
            cmd.Parameters.Add("@ExteriorLeaks", OleDbType.VarChar).Value = cblExLeaks.SelectedItem.Text;
            cmd.Parameters.Add("@Body", OleDbType.VarChar).Value = cblBody.SelectedItem.Text;
            cmd.Parameters.Add("@OilLevel", OleDbType.VarChar).Value = cblOil.SelectedItem.Text;
            cmd.Parameters.Add("@CoolantLevel", OleDbType.VarChar).Value = cblCool.SelectedItem.Text;
            cmd.Parameters.Add("@Belts", OleDbType.VarChar).Value = cblBelt.SelectedItem.Text;
            cmd.Parameters.Add("@EngineLeaks", OleDbType.VarChar).Value = cblEnLeak.SelectedItem.Text;
            cmd.Parameters.Add("@LooseBolts_Screws", OleDbType.VarChar).Value = cblScrew.SelectedItem.Text;
            cmd.Parameters.Add("@WarningTriangle", OleDbType.VarChar).Value = cblWTri.SelectedItem.Text;
            cmd.Parameters.Add("@FireExtinguishers_FirstAidKit", OleDbType.VarChar).Value = cblFire.SelectedItem.Text;
            cmd.Parameters.Add("@Defects", OleDbType.VarChar).Value = txtDefect.Text;
            cmd.Parameters.Add("@AdditionalComments", OleDbType.VarChar).Value = txtAddCom.Text;
            cmd.Parameters.Add("@CFirstName", OleDbType.VarChar).Value = txtFirstName.Text;
            cmd.Parameters.Add("@CLastName", OleDbType.VarChar).Value = txtLastName.Text;
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();

Dear friend,
The above code is working fine.
Noted Points
1.The table's columns name whatever it may be but the procedurename(@name) can be, is our own names.

Syntax:
Insert into TableName(column1,column2,column3) values(@pname1,@pname2,pname3)

Example:

con.Open();
cmd = new OleDbCommand("insert into tblcheck (id,[Tires/Wheels],Exhaust,[Lights/Reflectors],ExteriorLeaks) values(@id,@tires,@exhaust,@lights,@exterior) ", con);
cmd.Parameters.Add("@id", OleDbType.VarChar).Value = "1";
cmd.Parameters.Add("@tires", OleDbType.VarChar).Value = "2";
cmd.Parameters.Add("@exhaust", OleDbType.VarChar).Value = "2";
cmd.Parameters.Add("@lights", OleDbType.VarChar).Value = "1";
cmd.Parameters.Add("@exterior", OleDbType.VarChar).Value = "3";
cmd.ExecuteNonQuery();
con.Close();

Hope this will help you.!

This question has already been answered. Start a new discussion instead.