-
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 07:32 AM.
Reason: Added Code Tags
-
Your query could join 20 tables if you need it to. The result is still going to be just one recordset
-
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?
-
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~
-
 Originally Posted by nigege
feel sorry about this post.
Don't be sorry about anything...glad you got it worked out.
Similar Threads
-
By jackbabington in forum ASP.NET
Replies: 2
Last Post: 04-15-2008, 10:07 PM
-
By partyk1d24 in forum .NET
Replies: 1
Last Post: 05-02-2006, 03:55 AM
-
Replies: 5
Last Post: 04-01-2006, 01:53 AM
-
Replies: 0
Last Post: 04-04-2003, 06:25 PM
-
Replies: 0
Last Post: 04-04-2003, 06:13 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|