insert into desg values(" & Val(txtsno.Text) & ",'" & Trim(txtdesg.Text) & "'," & Val(txtbasic.Text) & ");

this how i used for inserting data to my access table in vb code.
how to do in c#?

"insert into desg values(" & Val(txtsno.Text) & ",'" & Trim(txtdesg.Text) & "'," & Val(txtbasic.Text) & ");" this how i used for inserting data to my access table in vb code.
how to do in c#?

I am unable to understand the motive the query.Give wat you want to do.

"INSERT INTO desg VALUES(" + txtsno.Text + ", " + txtdesg.Text +", " + txtbasic.Text + ");";

You dont need to worry about Trim and Val functions here. Trim will happen automatically and Val is irrelevant here

You should also stear away from inserting code just like that. Look into adding parameters:

SqlCommand comm = new SqlCommand("INSERT INTO desg VALUES (@txtsno, @txtdesg, @txtbasic)", connection);
comm.Parameters.AddWithValue("@txtsno", txtsno.Text.Trim());
comm.Parameters.AddWithValue("@txtsno", txtdesg.Text.Trim());
comm.Parameters.AddWithValue("@txtsno", txtbasic.Text.Trim());

This prevents SQL Injection.

sonakrish how do i insert Radio box value into the access database. for example, S=Small, M=Medium, or L=Large.

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