protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\gnani\websites\iconlabssite part2\App_Data\maindatabase.mdf;Integrated Security=True;"); SqlCommand insert = new SqlCommand("insert into regform(username, password, mobileno,emailid) values(@username, @password, @phoneno,@emailid)", conn); insert.Parameters.AddWithValue("@username", TextBox1.Text); insert.Parameters.AddWithValue("@password", TextBox2.Text); insert.Parameters.AddWithValue("@phoneno", TextBox4.Text); insert.Parameters.AddWithValue("@emailid", TextBox5.Text); try { conn.Open(); insert.ExecuteNonQuery(); } catch (Exception ex) { LMsg.ForeColor = System.Drawing.Color.Red; LMsg.Text = "Error when saving on database"; conn.Close(); } TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)