Create one .dbml file and make DataBase connection there and drag and drop the table inside the Dbml window. and right clcik on the field which field u want primary key and select the property option and give there True as primary key.
protected void btnUpdate_Click(object sender, EventArgs e)
{
linqStudent linObj = new linqStudent();
var obj = linObj.Students.SingleOrDefault(o => o.Roll == txtRoll.Text);
if (obj != null)
{
obj.Name = txtName.Text;
linObj.SubmitChanges();
}
}
protected void btnAdd_Click(object sender, EventArgs e)
{
linqStudent linObj = new linqStudent();
Student objStdebt = new Student();
objStdebt.Name = txtName.Text;
objStdebt.Roll = txtRoll.Text;
linObj.Students.InsertOnSubmit(objStdebt);
linObj.SubmitChanges();
}
Tuesday, December 21, 2010
Subscribe to:
Posts (Atom)