Complete CRUD Operations in Asp.Net C# with SQL | CRUD in Asp.Net C#

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


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

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

Well explained tutorial. Thanks for this awesome tutorial. keep continue!

azamchy
Автор

Continue please don't stop i learn too much from you

mahmoudsead
Автор

Well explained tutorial. Thanks for this awesome tutorial. keep continue!

azamchy
Автор

Well explained. Plz do more videos in asp.net c#

parvati
Автор

very good tutorial sir...please use validation also so that we can learn easily. thanks

rishiverma
Автор

Hi, Whenever I insert or try any of the CRUD operations, no change takes place on the web page, Could someone please help me on this.

justinsunildavid
Автор

Hi I want to install an application that is 64bit and also my windows is 64bit but when I want run setup I received an error " running 32bit installation on 64bit oprating system is not supported" can you help me?

aliyounesi
Автор

After Using store procedure for insert update . How can i use it on ado.net

subhakantaparida
Автор

Sir, can I ask for the source code, as study material at home?

rqtvhvr
Автор

very good tutorial. Can I have the Source code?

bellcal
Автор

How can I write after “ edit top 200 rows? Like you?

rim
Автор

Sir pls tell me what is the password default for db

memeskadesiadda
Автор

Sir I am getting error in sd.fill(dt); it says SQL execution was unhandle d bu user code an exception of the type occurred in system.data.dll but not handled in user code

stanzindeskong
Автор

It is not working when I am using stored procedure

debanjanabiswas