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

SQL Helper Class

Hello,

I'm using Microsoft Application Blocks in a project I'm working on.
I now need to populate a single dataset, that consists of 2 tables.
From what I've read, if I wasn't using MS Application Blocks, it would
simply be

dataAdapter1.fill(dataset1("table1")
dataAdapter1.newSelectCommandHere
dataAdapter1.fill(dataset1("table2")

Am I able to do this with the SQLHelper Class in MS App. Blocks?
I don't seem to be able to specify which table to load the data into...

This is my line of code:

Dim tables(1) As String
tables(0) = "table1"
tables(1) = "table2"

SqlHelper.FillDataset(SqlDbManager.GetConnectionSt ring,
CommandType.StoredProcedure, _
"Milestones_Read", ds, tables, sqlPararameter1)

Thanks!,
Amber

Nov 22 '05 #1
1 2438
Amber,

You can populate a dataset with multiple tables in a single trip.
Get your stored proceedure to do the 2 selects required
CREATE PROCEDURE Milestone_Read
AS
SELECT * FROM table1;
SELECT * FROM table2;

OR
Write a new proceedure to call the original 2 stored proceedures
CREATE PROCEDURE All_Milestone_Read
(

AS
EXEC SP1
EXEC SP2

Now just call your existing code with small mods to param 5 and 6.

SqlHelper.FillDataset(SqlDbManager.GetConnectionSt ring,
CommandType.StoredProcedure, _
"Milestones_Read", _
ds, _
new string() {"Table1","Table2"}, _ ' this names the tables
New SqlParameter() {("@Table1P1, p1"),("@Table2P1,p2"}) '
this passes any parameters
Oh ds.Table(0) is the result of the first select and ds.Table(1) is the
result of the second select and so on.
So you do need to know the order in which the sproc made the selects.

I have not actually compiled and tested this but it cant be far off.

Luck Chris
Nov 22 '05 #2

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

Similar topics

4
by: Robert Ferrell | last post by:
I have a style question. I have a class with a method, m1, which needs a helper function, hf. I can put hf inside m1, or I can make it another method of the class. The only place hf should ever...
2
by: Koen | last post by:
Hi all, I have a question about something rather common, but I'm a bit lost at the moment: Lat's say you have this: // in A.h Class A {
6
by: Alex Hunsley | last post by:
I know that I can catch access to unknown attributes with code something like the following: class example: def __getattr__(self, name): if name == 'age': return __age else: raise...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
8
by: Joe Johnston | last post by:
I need a Browser Helper object written in VB.NET Please point me at a good example. Joe MCPx3 ~ Hoping this MSDN ng three day turnaround is true. Additional info: What is a BHO? In its...
2
by: WB | last post by:
Hi, How can I access Server and Trace within a helper class? I have a webform that allows user to select a PDF file (on the web server) and render a jpeg image of that PDF file. The helper...
1
by: shaun roe | last post by:
When should a function be a private member, and when simply a standalone function in the .cpp file? I'm in the middle of writing a class which bridges between two packages, and so I need some...
6
by: mailforpr | last post by:
Suppose you have a couple of helper classes that are used by 2 client classes only. How can I hide these helper classes from other programmers? Do you think this solution is a good idea?: class...
6
by: Mike P | last post by:
I have heard about helper classes, but can somebody please explain to me what they are and what they are used? *** Sent via Developersdex http://www.developersdex.com ***
4
by: BobRoyAce | last post by:
Let's say I have a class called ClassA which has a bunch of member variables, properties, private and public methods. Then, let's say that I want to create another class, ClassACalcEngine, that...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
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...

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.