473,770 Members | 3,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading Results From a Stored Procedure

2 New Member
OK, so I have a stored procedure that ends like this ....

Expand|Select|Wrap|Line Numbers
  1. select @PulpMill as pulp_mill, @Supplier + ' - weighted' as supplier, @Species as species
  2.  
  3. select interval_date, weight_multiplied_cqi / total_weight as average_cqi
  4. from @WeightedIntervalTable
when you actually run the procedure in the Query Analizer it works fine. However im trying to build an Interface in VB.NET that can get the results from it. So far I have....

Expand|Select|Wrap|Line Numbers
  1.         Try
  2.             myConnection.Open()
  3.             'opening the connection
  4.             myCommand = New SqlCommand( _
  5.             "exec fax_cstr_chart_data 'Hopewell', 'Pine'", myConnection)
  6.  
  7.             'executing the command and assigning it to connection 
  8.             dr = myCommand.ExecuteReader()
  9.             While dr.Read 'reading from the datareader
  10.                 'Build Row Data From DataReader
  11.                 Dim NewRow As String() = {dr.Item(0).ToString, dr.Item(1).ToString, dr.Item(2).ToString}
  12.                 Me.dgHP.Rows.Add(NewRow) 'Add New Row
  13.             End While
  14.             dr.Close()
  15.             myConnection.Close()
  16.         Catch ex As Exception
  17.             MsgBox("Error : " & ex.Message)
  18.         End Try

However it only returns the first Select statements result, then the reader closes and it doesnt return the second select statements values.... How do you setup a reader to do this???
Aug 15 '07 #1
2 1623
ilearneditonline
130 Recognized Expert New Member
You will need to use SqlDataReader.N extResult.


Link
Aug 15 '07 #2
thecodewhore
2 New Member
THANK YOU!! I knew it would be simple.
Aug 15 '07 #3

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

Similar topics

4
7190
by: John | last post by:
Hi everyone, I have a stored procedure which I use to query a table. The first part of the stored procedure uses a cursor to update a temp table whilst the second part of the query actually retrieves information from a database table utilising information based on the temp table. My problem is that when I run the procedure, the cursors status is output and therefore becomes part of the result set. I really only want the information...
2
10168
by: Jegg | last post by:
I wrote a web app using an ASP front end (not .NET) connecting to a SQL Server 2000 (no SP) back end. Both the web server and the database server are Windows 2003 boxes. The app was running fine two weeks ago before I went on vacation. While I was gone my net admin applied Windows 2003 SP1 to the web server. Upon my return I was informed that the app is no longer working, getting the following error: Connection is busy with results...
1
2569
by: Mihaly | last post by:
I have a stored procedure in SQL Server 2000, and I want to read the error messages from this stored procedure. Please help me for this question: This is the stored procedure. Please supose than Column2 has no 0 values: CREATE PROCEDURE dbo.ErrorTest AS SELECT Column1 FROM Table WHERE Column2 = 0 IF (@@ROWCOUNT <= 0) GOTO RollB
4
3001
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and pass it to the Db and retrieveing data from a stored procedure, but I can't get the hang of parameters. I have a method where I can get the parameters passed to the sp but it doesn't want to return any results. Here's a copy of my code:
3
2055
by: Hewit | last post by:
I have a stored procedure which returns records and output parameters(SQL2K). How to call this stored procedure using ADO.Net so that I can use both results in my application. I have .Net Framework 1.1. when I use ExecuteReader() of Command object I cannot read the output parametrs of the stored procedure in code. Please advice. Hewit
2
2021
by: Sandy | last post by:
Hello - I have the following stored procedure and code. I want to put the results in two textboxes. I get to the part where I create the dataset and then I don't know what to do. I tried using a dataview with no luck. Stored procedure: ALTER Proc spFillSbjRply ( @key int
6
2711
by: Jim | last post by:
Can someone, please, show me how to display the results of a stored procedure in a VB.NET datagrid on a winform? I'm a newbie. Here's my SQL 2000 stored precedure that returns the status of SQL Jobs as a table. ================================================== CREATE PROCEDURE . AS
1
2313
by: Chris | last post by:
Hi, I created a VB SQL CRL Stored procedure for calculating a value. Value is returned as below Using sConn4 As New SqlConnection("context connection=true") sConn4.Open() scmd = New SqlCommand("SELECT " & var_max, sConn4) sdrd = scmd.ExecuteReader() SqlContext.Pipe.Send(sdrd)
4
7852
by: Utahduck | last post by:
I do a lot of file processing and I usually run a little script I copy and paste to read directory information to see if a new file it there and then process the file if it is. So, I decided to wise up and make a stored procedure to automate a lot of that. The pivotal step in this is that i run a command that looks like: CREATE TABLE #DIR (FileName varchar(100)) DECLARE @Cmd varchar(1050)
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8905
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.