Stored Procedure Insert,delete,Update

Posted by Dotnetfundakumar under Regular Expressions on 9/3/2009 | Views : 4493 | Status : [Member] | Replies : 5
I need create stored procedure in insert,Delete,update in sql and how to access in asp.net

Regards
Kumar



Responses

Posted by: Krunal1654 on: 8/5/2013 [Member] Starter | Points: 25

Up
0
Down
can u help me for update and delete using sqlhelper in store prosedure?

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 8/5/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Krunal

Here is the reference for the same using sql helper

http://www.codeproject.com/Tips/555870/SQL-Helper-Class-Microsoft-NET-Utility

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ssj_Kumar on: 8/6/2013 [Member] Starter | Points: 25

Up
0
Down
Below reference have the sample on using Sql Helper
http://www.codeproject.com/Articles/438259/Insert-Update-Search-and-Delete-CRUD-operation-usi

Regards,
Jayakumar Selvakani

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhangarg on: 9/3/2009 [Member] [Moderator] Silver

Up
0
Down
Hi-

Use liem this:

string strCon = "data source={Your Server IP};initial catalog={DB Name};user id={UserName};Password={Password}";

you can also add this connection string in Web.config and later fetch from there.

Use the attached SQLhelper Class that contain common function written to communicate to database.. there is no need to wite those manually..

Now use your Sp like This:

SqlParameter[] param = new SqlParameter[5];

param[0] = new SqlParameter("@XMLData", XMLData);
param[1] = new SqlParameter("@ParsedXML", ParsedXML);
param[2] = new SqlParameter("@ID", ID);
param[3] = new SqlParameter("@TypeID", TypeID);
param[4] = new SqlParameter("@OtherInfo", OtherInfo);
SqlHelper.ExecuteNonQuery("", CommandType.StoredProcedure, "{Sp Name}", param);


Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/
 Download source file

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 9/3/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down


For insert


Create Proc sp_Insert
(
@Name varchar(30),
@Lastname varchar(30),
@Age int
)
as
INSERT INTO TBL_USERS(NAME,LASTNAME,AGE)
VALUES(@NAME,@LASTNAME,@AGE)



For Update


Create Proc sp_Update
(
@Name varchar(30),
@Lastname varchar(30),
@Age int
)
as
UPDATE TBL_USERS
SET NAME = @NAME , LASTNAME =@LASTNAME ,AGE =@AGE

You can choose to add a where Clause to make it more Specific

For Delete


Create Proc sp_Delete
(
@Name varchar(30),
@AGE INT
)
as
DELETE TBL_USERS
WHERE NAME = @NAME
AND AGE =@AGE



Thank you for posting at DotnetFunda


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Dotnetfundakumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response