Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Data Connectivity
Message Icon Topic: Crystal Report Code doubt in Vb.Net 2005 Post Reply Post New Topic
Author Message
shamsu
Newbie
Newbie
Avatar

Joined: 26 Feb 2008
Location: India
Online Status: Offline
Posts: 2
Quote shamsu Replybullet Topic: Crystal Report Code doubt in Vb.Net 2005
    Posted: 26 Feb 2008 at 10:44pm
Hai Frnds...
 
          i have a doubt in the follwing code regarding Crystal Report.
          The bold statement when executed showing an error message "no tables in the record set". how to clear this error and do reply me.
          con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\HMS.mdb"
con.Open()
Dim da As New OleDb.OleDbDataAdapter("select * from DOCTOR", con)
Dim rs As New DataSet
da.Fill(rs)
Dim crt As New CrystalReport1


crt.SetDataSource(rs)

CrystalReportViewer1.ReportSource = crt

con.Close()


End Sub
Bava
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 27 Feb 2008 at 2:32pm
You need to fill a table with your data and then add the table to the dataset.  I don't work in VB.NET so I can't give you that code, but here's what code to do this sort of thing in C# looks like (I'm using Oracle components instead of OleDB, but the idea is the same...):
      OracleCommand getData = new OracleCommand(dbConnect, "Select * from Employee");
      OracleDataReader rdr = getData.ExecuteReader();
      DataTable tbl = new DataTable("UserData");
      tbl.Load(rdr);
      int idx = dsData.Tables.IndexOf("UserData");
      if (idx >= 0)
        dsData.Tables.Remove("UserData");
      dsData.Tables.Add(tbl);
 
-Dell
IP IP Logged
Twalker
Newbie
Newbie


Joined: 04 Mar 2008
Location: Canada
Online Status: Offline
Posts: 10
Quote Twalker Replybullet Posted: 04 Mar 2008 at 1:05pm
I found using Crystal.NET that you could assign a datatable directly to report datasource without placing it in a dataset.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 04 Mar 2008 at 1:26pm
Bava, did u test that the DataSet has data in it? I would try this:

crt.SetDataSource(rs.Tables(0))
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
shamsu
Newbie
Newbie
Avatar

Joined: 26 Feb 2008
Location: India
Online Status: Offline
Posts: 2
Quote shamsu Replybullet Posted: 04 Mar 2008 at 7:55pm
hai sir...
                         thanks for reply here i am added this code,no error but output is blank. so plese tell me how pass a table into a crystal Report in vb.Net2005. here i want urgent for a project copletion.

kindly repaly me
Bava
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 04 Mar 2008 at 9:19pm
http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2507

Edited by BrianBischof - 04 Mar 2008 at 9:20pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.