Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SqlCommand cmd = new SqlCommand();
       cmd.Connection = con;
       cmd.CommandType = CommandType.Text;
       cmd.CommandText = "insert into Register values(@Username,@Password,@Conform mail,@Repeat mail,@Date of birth,@Gender,@Mobile,@Address,@Select country,@Select state,@Select city,@Security question,@Captcha image)";
       cmd.Parameters.AddWithValue("@Username",TextBox1.Text.ToString());
       cmd.Parameters.AddWithValue("@Password", TextBox2.Text.ToString());
       cmd.Parameters.AddWithValue("@Conform mail", TextBox3.Text.ToString());
       cmd.Parameters.AddWithValue("@Repeat mail", TextBox4.Text.ToString());
       cmd.Parameters.AddWithValue("@Date of birth", TextBox5.Text.ToString());
       cmd.Parameters.AddWithValue("@Gender", RdoGender.SelectedItem.Text.ToString());
       cmd.Parameters.AddWithValue("@Mobile", TextBox7.Text.ToString());
       cmd.Parameters.AddWithValue("@Address", TextBox6.Text.ToString());
       cmd.Parameters.AddWithValue("@Select country", DropDownList1.Text.ToString());
       cmd.Parameters.AddWithValue("@Select state", DropDownList2.Text.ToString());
       cmd.Parameters.AddWithValue("@Select city", DropDownList3.Text.ToString());
       cmd.Parameters.AddWithValue("@Security question", TextBox9.Text.ToString());
       cmd.Parameters.AddWithValue("@Captcha image", TextBox8.Text.ToString());

       con.Open();
       cmd.ExecuteNonQuery();
       Response.Redirect("default.aspx");

       con.Close();
Posted
Comments
vangapally Naveen Kumar 4-Sep-14 4:28am    
Space is the problem. if you want to use singleword like @Confirm_mail or @confirmmail

1 solution

Space is the problem. Use single word parameter names like @Conformmail(right one) instead of @Conform mail(wrong one). Same thing goes for other parameters like @Repeat mail, @Date of birth, etc.,
 
Share this answer
 
Comments
Wendelius 4-Sep-14 23:38pm    
Nice answer, 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900