Results 1 to 9 of 9

Thread: Inserting radio buttons values into a database [* resolved *]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Inserting radio buttons values into a database [* resolved *]

    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
    Last edited by steve_rm; Nov 11th, 2004 at 09:58 AM.
    steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width