I am Using bootstrap templates
and i am want to save data in data base
don't show any Error or don't save data in database
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con;
con = new SqlConnection(ConfigurationManager.AppSettings["connect"]);
con.Open();
SqlCommand cmd;
cmd = new SqlCommand("Insert into registration (name,class) values('" + TextBox1.Text + "','" + TextBox2.Text + "')", con);
try
{
con.Open();
cmd.ExecuteNonQuery();
Label14.Text = "Data inserted successfully";
con.Close();
refress();
}
catch (Exception ex)
{
Label14.Text = ex.Message;
}
}

Ramesh PalanivelRank #372 · 6.8K reputationPosted Oct 4, 2017, 3:53 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Oct 4, 2017, 4:14 AM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Oct 4, 2017, 4:16 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Oct 4, 2017, 4:25 AM EDT
Sundaram SubramanianRank #150 · 15.2K reputationPosted Oct 4, 2017, 4:25 AM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Oct 4, 2017, 4:28 AM EDT
Jyoti JodhaRank #1,408 · 1.2K reputationPosted Oct 4, 2017, 4:32 AM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Oct 4, 2017, 4:39 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts