Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > ASP.NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-29-2009, 11:40 PM
nigege nigege is offline
Registered User
 
Join Date: Apr 2006
Posts: 55
fill dataset with 2 table using oledbdataAdaptor

hi, recently i want to do above process.

i have a query that join 2 table. i need to fill both table into dataAdaptor then fill into a dataset then use for crystalReport.

what should i do?? is this correct?
Code:
        Dim cmd As New OleDbCommand
        Dim conSQL As New OleDbConnection(ConfigurationSettings.AppSettings().Item("connectionStringR"))
        Dim sqlStr as String = "Select * from tableA join tableB on tableA.id=tableB.aid"
        Dim odbcCommand As String 
        conSQL.Open()
        odbcCommand = sqlStr
        cmd.CommandText = odbcCommand
        da.SelectCommand = cmd
        da.SelectCommand.Connection = conSQL
        da.TableMappings.Add("Table", "tableA")
        da.TableMappings.Add("Table1", "tableB")
        da.Fill(ds)
        CrtRptSource.ReportDocument.SetDataSource(ds)

Last edited by Hack; 10-30-2009 at 08:32 AM. Reason: Added Code Tags
Reply With Quote
  #2  
Old 10-30-2009, 08:33 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Your query could join 20 tables if you need it to. The result is still going to be just one recordset
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 11-01-2009, 09:14 PM
nigege nigege is offline
Registered User
 
Join Date: Apr 2006
Posts: 55
because my sqlstring is related to 2 tables, so if i join 2 tables together in 1 recordset, then my sqlstring will get those query data correctly or not? so that i can pass the recordset to my crystal reports as datasource. what if i cant get the correct records from the recordset, is there a right way for me to use?
Reply With Quote
  #4  
Old 11-02-2009, 04:32 AM
nigege nigege is offline
Registered User
 
Join Date: Apr 2006
Posts: 55
feel sorry about this post. the method is really function one. i just mis paired the database i retrieve data and report connected database. thank reply from Hacks, u r always helping me~
Reply With Quote
  #5  
Old 11-02-2009, 08:33 AM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Quote:
Originally Posted by nigege View Post
feel sorry about this post.
Don't be sorry about anything...glad you got it worked out.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
create dataset and fill gridview by data... jackbabington ASP.NET 2 04-15-2008 11:07 PM
Fill a treeview from a dataset partyk1d24 .NET 1 05-02-2006 04:55 AM
Using stored procedure to fill dataset Dasensa .NET 5 04-01-2006 01:53 AM
Attn: Daniel Reber joe Database 0 04-04-2003 06:25 PM
Re: (No subject) Joe Database 0 04-04-2003 06:13 PM


All times are GMT -4. The time now is 11:44 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.