Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old February 10th, 2008, 12:49 PM
Registered User
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 'Repeat' a stored procedure

Hi all

Still trying to get my head around VB.Net/ADO.Net and have a question.

I can't work out how to 'process' a stored procedure multiple times.

In other words, in VB6/ADO I would do something like:

For i = 1 to 10
    rs.Open "usp_Stored_Procedure '" & i & "'"
        ....process the results

In essence, the recordset variable has been created and I am simply opening
and closing it a number of times with different input values to the Stored

I think that I have started to get my head around 'easy' ADO.Net data
retrieval and can for instance open a data adapter and populate a data

What I can't seem to establish is how to write the equivalent of the above
code in ADO.Net.

My program contains the following

Dim rs As New SqlDataAdapter(strSQL, myConnection)....where strSQL is a
Stored Procedure and accepts a parameter.
        Dim rsTable As New Data.DataTable

....process the data

...and then I assume that I need to close the DataAdaptor (and Table)? i.e.

        rs = Nothing
rsTable = Nothing

If I want to repeat this do I contain the whole code above within a loop, so
that the DataAdaptor and DataTable are continually being created, disposed
of and created again i.e. is the following accurate...?

'Start the Loop here
For i = 1 to 10
Dim rs As New SqlDataAdapter(strSQL, myConnection)
        Dim rsTable As New Data.DataTable

....process the data

        rs = Nothing

rsTable = Nothing


The dataset will always only contain a single row - is there a better way to
process the above if data is limited to a single row each time?

Very many thanks for your consideration.

Shane Clark

Reply With Quote
  #2 (permalink)  
Old February 14th, 2008, 05:49 AM
Thearon's Avatar
Wrox Author
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts


Have a look at the SaveTimeSheet function on page 462. This should help you do what you want to do.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure prashant_telkar SQL Server 2000 1 July 9th, 2007 07:57 AM
Stored Procedure jezywrap SQL Server ASP 1 January 2nd, 2007 11:29 PM
Stored Procedure Help. midway11 SQL Language 3 November 20th, 2006 05:36 AM
Stored Procedure Help BukovanJ SQL Language 2 October 10th, 2006 08:02 AM
C# and stored procedure Msmsn C# 1 August 26th, 2003 11:03 PM

All times are GMT -4. The time now is 05:33 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.