473,399 Members | 3,919 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,399 software developers and data experts.

problem with code for dataset with mutilple tables

Hi

I'm not getting any data back on this code.

Can someone tell me what I'm doing wrong?

What I really want is to select fields out of two table where the display
= 'y' from both tables and in one table the email is = to variable I'm
passing.

Public Shared Function GetSelectedProgressReport(ByVal Email As String) As
DataSet

Dim dsCustProg As New DataSet

Dim cmdCustProg As New OleDbCommand

Dim cSelect As String = "SELECT * FROM ConstructionCustomers WHERE Display =
'y' and Email = @Email"

Dim pSelect As String = "SELECT * FROM ConstructionProgress WHERE Display =
'y'"

cmdCustProg.CommandText = cSelect

cmdCustProg.CommandText = pSelect

' Add Parameters to cmd

Dim parameterEmail As OleDbParameter = New OleDbParameter("@Email",
OleDbType.VarChar, 100)

parameterEmail.Value = Email

cmdCustProg.Parameters.Add(parameterEmail)

cmdCustProg.Connection = MyConnection()

Dim daCustomer As New OleDbDataAdapter

Dim daProgress As New OleDbDataAdapter

daCustomer.SelectCommand = cmdCustProg

daProgress.SelectCommand = cmdCustProg

daCustomer.Fill(dsCustProg, "ConstructionCustomers")

daProgress.Fill(dsCustProg, "ConstructionProgress")

Dim relation As DataRelation = _

dsCustProg.Relations.Add("CustProg", _

dsCustProg.Tables("ConstructionCustomers").Columns ("CustomerID"), _

dsCustProg.Tables("ConstructionProgress").Columns( "CustomerID"))

Return dsCustProg

End Function

Thanks,

CindyH
May 10 '06 #1
3 918
Cindy

Both adapters needs there own commands.
(The commandtext is no collection so you are now just overwriting it)

You can use the constructer by this by the way, which is much easier

Dim da as new OledbDataAdapter(SelectString, connection)

I hope this helps,

Cor

"Cindy H" <no*****@nowhere.com> schreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi

I'm not getting any data back on this code.

Can someone tell me what I'm doing wrong?

What I really want is to select fields out of two table where the
display
= 'y' from both tables and in one table the email is = to variable I'm
passing.

Public Shared Function GetSelectedProgressReport(ByVal Email As String) As
DataSet

Dim dsCustProg As New DataSet

Dim cmdCustProg As New OleDbCommand

Dim cSelect As String = "SELECT * FROM ConstructionCustomers WHERE Display
=
'y' and Email = @Email"

Dim pSelect As String = "SELECT * FROM ConstructionProgress WHERE Display
=
'y'"

cmdCustProg.CommandText = cSelect

cmdCustProg.CommandText = pSelect

' Add Parameters to cmd

Dim parameterEmail As OleDbParameter = New OleDbParameter("@Email",
OleDbType.VarChar, 100)

parameterEmail.Value = Email

cmdCustProg.Parameters.Add(parameterEmail)

cmdCustProg.Connection = MyConnection()

Dim daCustomer As New OleDbDataAdapter

Dim daProgress As New OleDbDataAdapter

daCustomer.SelectCommand = cmdCustProg

daProgress.SelectCommand = cmdCustProg

daCustomer.Fill(dsCustProg, "ConstructionCustomers")

daProgress.Fill(dsCustProg, "ConstructionProgress")

Dim relation As DataRelation = _

dsCustProg.Relations.Add("CustProg", _

dsCustProg.Tables("ConstructionCustomers").Columns ("CustomerID"), _

dsCustProg.Tables("ConstructionProgress").Columns( "CustomerID"))

Return dsCustProg

End Function

Thanks,

CindyH

May 10 '06 #2
Thanks, will give her a try.


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eG**************@TK2MSFTNGP02.phx.gbl...
Cindy

Both adapters needs there own commands.
(The commandtext is no collection so you are now just overwriting it)

You can use the constructer by this by the way, which is much easier

Dim da as new OledbDataAdapter(SelectString, connection)

I hope this helps,

Cor

"Cindy H" <no*****@nowhere.com> schreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi

I'm not getting any data back on this code.

Can someone tell me what I'm doing wrong?

What I really want is to select fields out of two table where the
display
= 'y' from both tables and in one table the email is = to variable I'm
passing.

Public Shared Function GetSelectedProgressReport(ByVal Email As String)
As
DataSet

Dim dsCustProg As New DataSet

Dim cmdCustProg As New OleDbCommand

Dim cSelect As String = "SELECT * FROM ConstructionCustomers WHERE
Display =
'y' and Email = @Email"

Dim pSelect As String = "SELECT * FROM ConstructionProgress WHERE Display
=
'y'"

cmdCustProg.CommandText = cSelect

cmdCustProg.CommandText = pSelect

' Add Parameters to cmd

Dim parameterEmail As OleDbParameter = New OleDbParameter("@Email",
OleDbType.VarChar, 100)

parameterEmail.Value = Email

cmdCustProg.Parameters.Add(parameterEmail)

cmdCustProg.Connection = MyConnection()

Dim daCustomer As New OleDbDataAdapter

Dim daProgress As New OleDbDataAdapter

daCustomer.SelectCommand = cmdCustProg

daProgress.SelectCommand = cmdCustProg

daCustomer.Fill(dsCustProg, "ConstructionCustomers")

daProgress.Fill(dsCustProg, "ConstructionProgress")

Dim relation As DataRelation = _

dsCustProg.Relations.Add("CustProg", _

dsCustProg.Tables("ConstructionCustomers").Columns ("CustomerID"), _

dsCustProg.Tables("ConstructionProgress").Columns( "CustomerID"))

Return dsCustProg

End Function

Thanks,

CindyH


May 10 '06 #3
I've run into this exact problem a whole lot of times. I've been using
a tool called the DataSet Toolkit so that I don't have to write the
code for all the data adapters that your example contains. Check it
out and let me know if it works for you.

http://www.hydrussoftware.com

John B.
http://johnsbraindump.blogspot.com

May 26 '06 #4

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

Similar topics

2
by: John Holmes | last post by:
I have a web interface where the user types in ID's one at a time. After an ID is typed in, a button is clicked and the button click event has code that does a query and returns a data reader and...
3
by: Alex Ayzin | last post by:
Hi, I have a problem that might be easy to solve(possibly, I've just overlooked an easy solution). Here we go: I have a dataset with 2 datatables in it. Now, I need to do the following: if...
2
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System;...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I am converting Excel data into a Dataset in C#. There are around 24 columns in the Excel Sheet. First I tried to insert one row with correct values in the Excel sheet. i.e. for text columns...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.