What is the error in the folloing code?

I am not able to add data to the table

cmd.CommandText = "insert into master (FirstName, middlename, lastname, [addressline 1], [addressline 2], city, pincode, state, country, Nationality, sex, DOB) values ('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + textBox6.Text + "', '" + textBox10.Text + "', '" + textBox7.Text + "', '" + textBox8.Text + "', '" + textBox9.Text + "', '" + gender + "', ''" + dateTimePicker1.Value + ")";

            int a=cmd.ExecuteNonQuery();

What error message do you get? Looks like the single quotes are both before the last value, instead of around.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.