|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
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?
|
|
#4
|
|||
|
|||
|
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~
|
|
#5
|
||||
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
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 |