Your query is vulnerable to SQL Injection attacks. You should use parameterized queries to build your sql query from user input, not concatenated strings.
Many students (in particular) counter that comment with "but I am the only one using the database". However using parameterized queries can often overcome other issues such as mismatched single quotes, date formats etc.
Change your query to something like this
var con = new SqlConnection();
con.Open();
string str1 = "insert into ram(fn,ln,un,pw,con,bod,q1,ans1,q2,ans2) values(@firstname,@lastname,@username,@password,@contake,@dateTime,@cmbq1,@ans1,@cmbq2,@ans2)";
SqlCommand cmd = new SqlCommand(str1, con);
cmd.Parameters.AddWithValue("@firstname", txtfirstname.Text);
cmd.Parameters.AddWithValue("@lastname", txtlastname.Text);
cmd.Parameters.AddWithValue("@username", txtusername.Text);
cmd.Parameters.AddWithValue("@password", txtpassword.Text);
cmd.Parameters.AddWithValue("@contake", txtcontake.Text);
cmd.Parameters.AddWithValue("@datetime", txtdateTimePicker.Value);
cmd.Parameters.AddWithValue("@cmbq1", cmbq1.Text);
cmd.Parameters.AddWithValue("ans1", txtans1.Text);
cmd.Parameters.AddWithValue("@cmbq2", cmbq2.Text);
cmd.Parameters.AddWithValue("ans2", txtans2.Text);
I agree with @FES-Sitecore, if you are not getting an error reported then you probably have a try-catch block where you are ignoring the error. However, it is likely to have been the date (txtdateTimePicker.Value) that caused the error. Using the parameters as suggested above may overcome that problem as well, it depends on the type of column
bod