//select command
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testCon db = new db_testCon();
tblCustomer tb = db.tblCustomers.Single(p => p.CustomerID == idToupdate);
TextBox1.Text = tb.City;
and
db_testModel.db_testcon db = new db_testcon();
Repeater1.DataSource = db.tblCustomer;
Repeater1.DataBind();
//update commnd
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testCon db = new db_testCon();
tblCustomer tb = db.tblCustomers.SingleOrDefault(a=>a.CustomerID==idToupdate);
tb.City = TextBox1.Text;
db.SaveChanges();
//Add Command
db_testcon db = new db_testcon();
tblCustomer tb = new tblCustomer();
tb.CompanyName = TextBox1.Text;
tb.ContactName = TextBox2.Text;
tb.City = TextBox3.Text;
db.tblCustomer.AddObject(tb);
if (db.SaveChanges() == 1) { Response.Redirect("et.aspx"); }
//delete command
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testcon db1 = new db_testcon();
tblCustomer tb = db1.tblCustomer.SingleOrDefault(a => a.CustomerID == idToupdate);
db1.tblCustomer.DeleteObject(tb);
db1.SaveChanges();
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testCon db = new db_testCon();
tblCustomer tb = db.tblCustomers.Single(p => p.CustomerID == idToupdate);
TextBox1.Text = tb.City;
and
db_testModel.db_testcon db = new db_testcon();
Repeater1.DataSource = db.tblCustomer;
Repeater1.DataBind();
//update commnd
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testCon db = new db_testCon();
tblCustomer tb = db.tblCustomers.SingleOrDefault(a=>a.CustomerID==idToupdate);
tb.City = TextBox1.Text;
db.SaveChanges();
//Add Command
db_testcon db = new db_testcon();
tblCustomer tb = new tblCustomer();
tb.CompanyName = TextBox1.Text;
tb.ContactName = TextBox2.Text;
tb.City = TextBox3.Text;
db.tblCustomer.AddObject(tb);
if (db.SaveChanges() == 1) { Response.Redirect("et.aspx"); }
//delete command
int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
db_testcon db1 = new db_testcon();
tblCustomer tb = db1.tblCustomer.SingleOrDefault(a => a.CustomerID == idToupdate);
db1.tblCustomer.DeleteObject(tb);
db1.SaveChanges();
No comments:
Post a Comment