protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Classmysql.getconn(); txtid.Focus(); txtname.Text = "neha"; str = "select max(sno+1) from tblid"; cmd = new MySqlCommand(str, Classmysql.con); dtp = new MySqlDataAdapter(cmd); ds = new DataSet(); dtp.Fill(ds); if (ds.Tables[0].Rows[0][0] == DBNull.Value) { txtid.Text = "1"; } else { txtid.Text = ds.Tables[0].Rows[0][0].ToString(); } cmd = new MySqlCommand("insert into tblid values(" + txtid.Text + ",'" + txtname.Text + "','1')", Classmysql.con); tn = Classmysql.con.BeginTransaction(IsolationLevel.Serializable); cmd.Transaction = tn; cmd.ExecuteNonQuery(); tn.Commit(); str = "select * from tblid"; cmd = new MySqlCommand(str, Classmysql.con); dtp = new MySqlDataAdapter(cmd); ds = new DataSet(); dtp.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); Classmysql.closeconn(); } } catch (MySqlException ee) { // tn.Rollback(); excepionmethod(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)