DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: fill dataset with 2 table using oledbdataAdaptor

  1. #1
    Join Date
    Apr 2006
    Posts
    56

    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

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Your query could join 20 tables if you need it to. The result is still going to be just one recordset

  3. #3
    Join Date
    Apr 2006
    Posts
    56
    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. #4
    Join Date
    Apr 2006
    Posts
    56
    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. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Quote Originally Posted by nigege View Post
    feel sorry about this post.
    Don't be sorry about anything...glad you got it worked out.

Similar Threads

  1. create dataset and fill gridview by data...
    By jackbabington in forum ASP.NET
    Replies: 2
    Last Post: 04-15-2008, 10:07 PM
  2. Fill a treeview from a dataset
    By partyk1d24 in forum .NET
    Replies: 1
    Last Post: 05-02-2006, 03:55 AM
  3. Using stored procedure to fill dataset
    By Dasensa in forum .NET
    Replies: 5
    Last Post: 04-01-2006, 01:53 AM
  4. Attn: Daniel Reber
    By joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 06:25 PM
  5. Re: (No subject)
    By Joe in forum Database
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center