Hello there,
I am a beginner to C# and trying to insert signup data in MSSQL. but getting System.Data.SqlClient.SqlException .in System.Data.dll. I have successfully inserted data in other pages but here I am facing this issue. code is as follows
- void SignUpNewMember()
- {
- try
- {
- SqlConnection con = new SqlConnection(strcon);
- if (con.State == ConnectionState.Closed)
- {
- con.Open();
- }
- SqlCommand cmd = new SqlCommand("INSERT INTO member_master_tbl (full_name,dob,contact_no,email,state,city,pincode,full_address,member_id,password,account_status) values (@full_name,@dob,@contact_no,@email,@state,@city,@pincode,@full_address,@member_id,@password,@account_status)", con);
- cmd.Parameters.AddWithValue("@full_name", TextBox1.Text.Trim());
- cmd.Parameters.AddWithValue("@dob", TextBox2.Text.Trim());
- cmd.Parameters.AddWithValue("@contact_no", TextBox3.Text.Trim());
- cmd.Parameters.AddWithValue("@email", TextBox4.Text.Trim());
- cmd.Parameters.AddWithValue("@state", DropDownList1.SelectedItem.Value);
- cmd.Parameters.AddWithValue("@city", TextBox6.Text.Trim());
- cmd.Parameters.AddWithValue("@pincode", TextBox7.Text.Trim());
- cmd.Parameters.AddWithValue("@full_address", TextBox5.Text.Trim());
- cmd.Parameters.AddWithValue("@member_id", TextBox8.Text.Trim());
- cmd.Parameters.AddWithValue("@password", TextBox9.Text.Trim());
- cmd.Parameters.AddWithValue("@account_status", "pending");
- cmd.ExecuteNonQuery();
- con.Close();
- Response.Write("");
- }
- catch (Exception ex)
- {
- Response.Write("");
- }
- }
plz guide what is wrong with this code as the same code is working on other pages
Regards
MSK AfridiPosted Apr 8, 2020, 11:57 AM
Amit GuptaPosted Apr 7, 2020, 8:23 AM
MSK AfridiPosted Apr 6, 2020, 1:12 PM
Vinay SinghPosted Apr 6, 2020, 5:50 AM
Jignesh KumarPosted Apr 5, 2020, 1:28 PM
MSK AfridiPosted Apr 5, 2020, 11:44 AM
MSK AfridiPosted Apr 5, 2020, 5:22 AM
Amit GuptaPosted Apr 5, 2020, 3:24 AM
Jignesh KumarPosted Apr 5, 2020, 2:31 AM
MSK AfridiPosted Apr 4, 2020, 2:56 PM
Amit GuptaPosted Apr 4, 2020, 1:07 PM
MSK AfridiPosted Apr 4, 2020, 12:19 PM
Jignesh KumarPosted Apr 4, 2020, 11:33 AM
Rajanikant HawaldarPosted Apr 4, 2020, 11:26 AM