Hello Students, Friends, Subscribers,
In This Video Tutorial You will Learn How to Update or Edit Data After Searching Particular Record into Database Using Stored Procedure in Asp.Net C#.
Download Our All 400+ Videos Asp.Net Code : Just Paying Onetime Amount Rs.49/- Only
Buy and Download All 400+ Codes Here ( 100% Working Code ) :
https://beststudyguru.myinstamojo.com...
or
You can also buy our pendrive of 32GB Which will include 400+Videos in Mp4 Format So You can watch all Videos Without Internet and Learn Asp.Net in Hindi At Your Home Easily. We will send you the pendrive through Courier. You have to pay Just Rs.999/- ( Include All Source Code File + 400+Videos + 32GB Pendrive ) Only For Indian Users
Buy Our Pendrive Here :
https://www.instamojo.com/beststudygu...
--------------------------------------------------------------
If You like our work and Enhanced Your Programming Skill Through Our Channel, You can Donate to This Channel to Keep The Mission Programming Carry On. Many Students Already Making Efforts.
Click This Link to Donate.
https://www.instamojo.com/beststudygu...
-------------------------------------------------------------------------
Important Coding
---------------------------------
Coding For Create Search Stored Procedure
---
create procedure SearchStudent3
(
@strollno int
)
as
begin
Select * from studentinfo where srollno=@strollno
end
-----
Coding For Update Stored Procedure
-----
use StudentData
create procedure UpdateStudent1
(
@strollno int,
@stname varchar(50),
@stfname varchar(50),
@stcity varchar(50)
)
as
begin
update studentinfo set sname=@stname, fname=@stfname, city=@stcity where srollno=@strollno
end
------
Coding For Search Button
---
String constring = "Data Source=VIKAS-PC\\SQLEXPRESS; Initial Catalog=StudentData; Integrated Security=true";
SqlConnection sqlcon = new SqlConnection(constring);
String pname = "SearchStudent3"; ;
sqlcon.Open();
SqlCommand com = new SqlCommand(pname, sqlcon);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@strollno", Convert.ToInt32(TextBox1.Text));
SqlDataReader dr;
dr = com.ExecuteReader();
if (dr.Read())
{
TextBox2.Text = dr["sname"].ToString();
TextBox3.Text = dr["fname"].ToString();
TextBox4.Text = dr["city"].ToString();
Label2.Text = "Data Has Been Found";
}
else
{
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Label2.Text = "Data Has Not Been Found";
}
sqlcon.Close();
------
Coding For Update Button
---
String constring = "Data Source=VIKAS-PC\\SQLEXPRESS; Initial Catalog=StudentData; Integrated Security=true";
SqlConnection sqlcon = new SqlConnection(constring);
String pname = "UpdateStudent1"; ;
sqlcon.Open();
SqlCommand com = new SqlCommand(pname, sqlcon);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@strollno", Convert.ToInt32(TextBox1.Text));
com.Parameters.AddWithValue("@stname", TextBox2.Text.ToString());
com.Parameters.AddWithValue("@stfname", TextBox3.Text.ToString());
com.Parameters.AddWithValue("@stcity", TextBox4.Text.ToString());
com.ExecuteNonQuery();
sqlcon.Close();
Label3.Text = "Data Has Been Updated in Database";
-------------
--------------
Subscribe Our YouTube Channel - Like, Comment & Share Our Videos
/ haritistudyhubeasylearn
--------------
Like & Share Our Facebook Page
/ haritistudyhub
--------------
if You Have Any Problem and Doubt in Programming Language
Feel Free to Email Us
BestStudyGuru @ Gmail.Com
--------------