SqlConnection cn = new SqlConnection(MyConn.cnstring);
//string sql = "insert into Insert1 values(?,?,?,?,?)";
SqlCommand cmd ;
cmd = new SqlCommand("insert into Insert1 values(?,?,?,?,?)", cn);
cmd.Parameters.AddWithValue("sname", txtname.Text);
cmd.Parameters.AddWithValue("srno", txtrno.Text);
cmd.Parameters.AddWithValue("sdob", dob.Value);
cmd.Parameters.AddWithValue("sadd", txtadd.Text);
cmd.Parameters.AddWithValue("sgender", cmdgender.Text);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
When I use this code folowing error will gererate
"Incorrect syntax near '?'."