Complete CRUD Operation in Asp.Net C# with SQL Using Linq Step by Step | ProgrammingGeek

preview_player
Показать описание

Prerequisites.
You should have installed SQL server and visual studio. you can use SQL server integrated with visual studio instead of SQL Server management studio.

This tutorial also covered-
2. Creating SQL server database and table in SQL server.
3. Creating method in c# using linq.
4. Calling method in button click_event.
5. Using method in page_load event.
8. How to load data in GridView.

DataClassesDataContext db = new DataClassesDataContext();
protected void Button1_Click(object sender, EventArgs e)
{
try
{
int uid = int.Parse(txtid.Text);
string uname = txtname.Text, address = Dropaddress.SelectedValue, sex = Radiosex.SelectedValue;
double age = double.Parse(txtage.Text);
DateTime dob = DateTime.Parse(txtdob.Text);

var st = new UserInfo_Tab
{
UserID = uid,
UserName = uname,
Address = address,
Age = age,
Sex = sex,
DateOfBirth = dob
};
db.UserInfo_Tabs.InsertOnSubmit(st);
db.SubmitChanges();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Successfully Inserted');", true);
LoadUser();
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('"+ex.Message.ToString()+"');", true);
}
}
void LoadUser()
{
var st = from s in db.UserInfo_Tabs select s;
GridView1.DataSource = st;
GridView1.DataBind();
}

Visit my page in Facebook
------
More Tags
#CRUDOperationInAsp.NetCSharpWithSQLUsingLinq #CompleteCRUDOperation #CRUDInCSharpWithSQL

Рекомендации по теме
Комментарии
Автор

This is most important video, helpful for my life.

md.firozalam
Автор

Wow 🥺🥺. Outstanding. Thanks for sharing.

nizamuddin
Автор

Can you share the Default.aspx code or your GitHub repository

kshitijbisht