473,385 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

executing Stroed procedures using .net

Hi guys! can any one help me to know how we can execute stored procedures of SQL server in .net
Jan 18 '08 #1
2 969
mathewgk80
103 100+
Hi guys! can any one help me to know how we can execute stored procedures of SQL server in .net
Hi,
Expand|Select|Wrap|Line Numbers
  1.  sqlConRowUpdate = new SqlConnection(strConnectionString);
  2.             sqlConRowUpdate.Open();
  3.             SqlCommand SqlCmdRowUpdate = new SqlCommand();
  4.             SqlCmdRowUpdate.Connection = sqlConRowUpdate;
  5.             SqlCmdRowUpdate.CommandText = "procUpdatePDetails";
  6.             SqlCmdRowUpdate.CommandType = CommandType.StoredProcedure;
  7.             SqlCmdRowUpdate.Parameters.Add("@purchaseid", SqlDbType.VarChar).Value = strPurchaseId;
  8.             SqlCmdRowUpdate.Parameters.Add("@productname", SqlDbType.VarChar).Value = strProductNameNew;
  9.             SqlCmdRowUpdate.Parameters.Add("@noofitems", SqlDbType.Int).Value = intNoOfItems;
  10.             SqlCmdRowUpdate.Parameters.Add("@priceperunit", SqlDbType.Int).Value = intPricePerUnit;
  11.             SqlCmdRowUpdate.ExecuteNonQuery();
  12.  
The above is an example of executing stored procedure in .net. In the above code,"procUpdatePDetails" is the stored procedure.

Regards,

Mathew.
Jan 18 '08 #2
hi,

thank u mathew. i got an idea of using the stored procedures through the example given by you. thank u for ur timely help. looking forward for a good team work with u and other team members. Have A Nice Day!
regards,
vijay
Jan 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is...
1
by: Eugene Anthony | last post by:
Method 1: set rs = Server.CreateObject("ADODB.Recordset") objConn.usp_RetrieveCategories rs Method 2: set rs = objConn.Execute("usp_RetriveCategories") Which method is considered to...
1
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is...
1
by: Ville Huovinen | last post by:
Platform: Windows 2003 Server (MS SQL Server 2003 SP3) Language: C# Problem: My stored procedures times out randomly, some proces works fine when using them from C#, and some generate...
4
by: Yoshitha | last post by:
Hi i've created stored procedure in sql server 2000 which returns a value see the stroed procedure CREATE PROCEDURE QA_Select_AdminOrRec @Role varchar(50),
1
by: A1 Ronen | last post by:
Hi all I got problem regarding executing all stored procedure through common procedures where we have different parameter with different names, type and data type The Function is as follows...
2
by: SQLusername | last post by:
I am having trouble executing a series of 4 stored procedures from VB. The connection code connects and the first 3 stored procedures run through, although the 4th procedure stops running mid...
0
debasisdas
by: debasisdas | last post by:
This thread contains some of the sample code showing the method of executing Oracle stored procedures and functions from VB . Hope the user finds them useful. Oracle Procedure with only IN...
2
by: Carlton Kirby | last post by:
I need to execute a job on a SQL Express 2005 instance (no SQLAgent). The job will be executed manually by a user, so it doesn't need to be scheduled to run automatically. I thought I could...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.