protected void Page_Load(object sender, EventArgs e)
{
string r = @"server=.;database=romesh;trusted_connecton=true";
SqlConnection con = new SqlConnection(r);
}
protected void btn_insert_Click(object sender, EventArgs e)
{
string i= "insert into sample values('"+txt1.Text+"','"+txt2.Text+"','"+txt3.Text+"')";
con.open();
SqlCommand cmd = con.createcommend();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "i";
cmd.EndExecuteNonQuery();
con.close();
}
}
// I will get the error my code