Print Page | Close Window

Crystal Report Code doubt in Vb.Net 2005

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2450
Printed Date: 27 May 2024 at 1:48pm


Topic: Crystal Report Code doubt in Vb.Net 2005
Posted By: shamsu
Subject: Crystal Report Code doubt in Vb.Net 2005
Date 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



Replies:
Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Twalker
Date 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.


Posted By: BrianBischof
Date 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>


Posted By: shamsu
Date 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


Posted By: BrianBischof
Date Posted: 04 Mar 2008 at 9:19pm
http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2507 - http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2507

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



Print Page | Close Window