473,422 Members | 1,804 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,422 software developers and data experts.

How to call parameterized stored procedure to return result set?

Hi,

If I have a stored procedure in my database, that has two parameters (say @a
nvarchar(50) and @b int), and returns the result of a SELECT statement
(returns a result set), how can I set up the parameters, how can I call it,
and how can I iterate through the rows of the returned resultset?

thanks,
Lacka
Nov 19 '05 #1
2 1662
Lacka, I answered how to return iterate through it in your other post, as
for your two other questions:

Dim connection As New SqlConnection("...")
Dim command As New SqlCommand("Your sp name", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@a", SqlDbType.NVarChar, 50).Value = "some
value"
command.Parameters.Add("@b", SqlDbType.Int).Value = 1
Dim da As New SqlDataAdapter(command)
Try
Dim ds As New DataSet
connection.Open()
da.Fill(ds)
Finally
connection.Dispose()
command.Dispose()
da.Dispose()
End Try

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Lacka" <la***@chello.hu> wrote in message
news:en****************@TK2MSFTNGP14.phx.gbl...
Hi,

If I have a stored procedure in my database, that has two parameters (say @a nvarchar(50) and @b int), and returns the result of a SELECT statement
(returns a result set), how can I set up the parameters, how can I call it, and how can I iterate through the rows of the returned resultset?

thanks,
Lacka

Nov 19 '05 #2
Thanks!
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
3
by: Chris | last post by:
Hello everyone I want to call a DB2 7.2 stored procedure via ADO in VC++ 7.1 It has 4 parameters, the 1st and the 4th are OUTPUT and the others are INPUT params. My code looks like this:...
4
by: Jean-Marc Blaise | last post by:
Dear all, I have simulated the windows MULTI application with a java program calling the SQLTP1DL proc referenced as DB2DARI application, on Linux Intel or ZLinux. If the proc is NOT FENCED,...
13
by: Marcin Wasilewski | last post by:
Hi, How to call procedure, which is on SQL Server from Access using visual basic? Thanks, mw
0
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a...
4
by: nishi57 | last post by:
I hope I can get some help regarding this issue, which has been going on for a while. I have a desktop user who is having problem running "Stored Procedures". The DB2 Connect application works fine...
3
by: mandible | last post by:
I'm trying to call one stored procedure inside another. I was wondering if this is possible Some ideas I was toying with is putting the first stored procedure inside of a temp table but haven't...
2
by: Krij | last post by:
Hi, I'm a student and I have the following working example that troubles me (in SQL Server 2005): CREATE PROCEDURE dbo.CustomersOrderHistory ( @Firstname varchar(7) OUTPUT) AS SELECT ...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.