Showing dataset data on Crystal Report

  • Thread starter Thread starter Ceri
  • Start date Start date
C

Ceri

I have been trying to display dataset data in a Crystal Report in a
Crystal Reports Viewer using VB.Net. Displaying the data from the
default xtreme.mdb Access database was no problem, but when trying to
display data from an SQL 2000 database, no data ever shows. Could
somebody please tell me what alterations need to be made to the
following code?

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
InitializeComponent()
Dim newRpt As New empsReport 'Name of Crystal Report
Dim newConn As New
OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=pubs;Data Source=xxxxx;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=xxxxx;Use Encryption for Data=False;Tag with
column collation when possible=False")
Dim newAdapter As New OleDbDataAdapter("SELECT fname, lname
FROM employee", newConn)
Dim dataSet As New dsEmps 'Name of .xsd dataset that has been
created with the Employee table
newAdapter.Fill(dataSet, "employees")
newRpt.SetDataSource(dataSet)
CrystalReportViewer1.ReportSource() = newRpt
CrystalReportViewer1.DataBind()
End Sub

I am trying it with an OleDbConnection as I thought that I may have
more joy with this after failing with an SQLConnection. The code runs
without a problem, but the report only shows the field headings, and
not the data entries. All I have done is convert the code for
connecting to the Access Database, and I have been unable to find any
VB.Net solution. A solution to my problem would be greatly
appreciated.
 
Doh! I thought this was a Winform not a web project. Hopefully the links
will still be helpful.

Greg
 
Back
Top