filmov
tv
Complete CRUD Operations in Asp.Net C# with SQL | CRUD in Asp.Net C#
Показать описание
Just follow this steps-
1. Create a new Asp.Net project.
2. Design the project with Label, TextBox, RadiobuttonList, DropdownList and button control.
3. Create database and table in SQL Server using Object Explorer.
4. Connect SQL server with visual studio using Server Explorer.
6. Debug and test.
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.
3. Creating method in c#.
4. Calling method in another event.
5. How to load data in GridView.
protected void Button1_Click(object sender, EventArgs e)
{
int empid = int.Parse(TextBox1.Text);
string empname = TextBox2.Text, city = DropDownList1.SelectedValue, sex = RadioButtonList1.SelectedValue, contact = TextBox5.Text;
double age = double.Parse(TextBox3.Text);
DateTime jdate = DateTime.Parse(TextBox4.Text);
connection.Open();
SqlCommand command = new SqlCommand("Insert into EmployeeSetup_Tab values ('"+empid+ "','" + empname + "','" + city + "','" + age + "','" + sex + "','" + jdate+ "','" + contact + "')", connection);
command.ExecuteNonQuery();
connection.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Successfully saved');", true);
GetEmployeeList();
}
void GetEmployeeList()
{
SqlCommand command = new SqlCommand("Select * from EmployeeSetup_Tab", connection);
SqlDataAdapter sd = new SqlDataAdapter(command);
DataTable dt = new DataTable();
sd.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
~~~~~~~~~~~~~
You can also know all the programming techniques, and bug fixing, error solution in my channel Swift learn.
~~~~~~~~~~~~~
Share this video with anyone if you think as useful.
Please leave a suggestions for future tutorials in the comment section below.
~~~~~~~~~~~~~
Connect with me
More Tags
#SimpleCRUDOperationAsp.Net #CRUDinAsp.NetC #CRUDOperationAsp.Net #SwiftLearn
Комментарии