Inserting radio buttons values into a database
Hello,
I have a database with 3 fields High and Low. The datatype in the database using MS Access is 'YesNo'.
I have this code in Visual C#
Code:
OleDbCommand cmdInsert = cnnstrInsert.CreateCommand();
cmdInsert.CommandType = CommandType.Text;
cmdInsert.CommandText = @"INSERT INTO Customer(Customer, High, Low) VALUES('" + txtCustID.Text + "', '" + radHigh.Checked + "', "' + radLow.Checked + "') ";
cmdInsert.ExecuteNonQuery();
There is nothing wrong with the actual syntax, but how do l send the values for the radio buttons to the database.
I keep getting a error msg say "incorrect datatype match". So started to do some testing and used this in the connection string instead.
@"INSERT INTO Customer(Customer, High, Low) VALUES('" + txtCustID.Text + "', 'True', 'False') ";
This still gave the same error.
Can anyone tell me the correct way to insert the values of radio buttons into a database.
Many thanks in advance,
Steve