dataset and crystal report basic problem


A

Aussie Rules

Hi,

I have a crystal report that I designed against a SQL server databas. I am
now using sqlexpress so have to use a dataset as the source of the reports
data as in sql express i am attaching the database at run time.

So I have followed the guides, and have a dataset added to my vb.net2008
solution. When I go into the dataset designer I can preview the data no
problem (its a basic select sql statment with no params)

I have then added the fields to my report, but when I run the report I get
the column headins, but no data displayed?

What have I missed her?



Dim report As New test 'basic report

Dim Adapter As SqlDataAdapter = New SqlDataAdapter("select * from
rpt_compare", dbConnection) 'Passing the query in the connection

Dim DataSet As DataSet = New DataSet() 'DataSet

Adapter.Fill(DataSet)

Dim DataTable As DataTable = New DataTable 'DataTable

DataTable = DataSet.Tables(0) 'filling the datatable here

Report.SetDataSource(DataTable)

CrystalReportViewer1.ReportSource = Report
 
Ad

Advertisements

M

mabond

Hi

this works for me....just a dataset

Public Sub fillReport(ByVal sender As System.Object)
Try
myReport = New MyReport (this is the Crystasl report)
Dim myDataSet As DataSet
myDataSet = MyReportDataset
myreport.SetDataSource(myDataSet)
me.CrystalReportViewer1.ReportSource = myReport
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Public Shared ReadOnly Property MyReportDataSet() As DataSet
Get
Dim mySqlDataAdapter As SqlDataAdapter
Dim myDataSet As ReportDataSet = New ReportDataSet (this is the
dataset object from your project)
Dim mySqlConnection As SqlConnection = New
SqlConnection(connectionstring)

mySqlDataAdapter = New SqlDataAdapter(querystringhere,
mySqlConnection)
mySqlDataAdapter.Fill(myDataSet, tablenamehere)

Return myDataSet

End Get
End Property


Hope this helps

Regards

Michael Bond
 
A

Aussie Rules

Hi.

I still get my col headings back but not data so the report is empty?

Also in the report designer when I preview the report it shows what seems to
be dummy data generated by Crystal. Is this the signe of a problem as well,
or just that its using a dataset, which whilst vb.net ide is in design mode
it can't get any data to use in the preview ?

Thanks
 
Ad

Advertisements

M

mabond

Hi

the preview is just dummy data...so not a problem.

What I usually do in this kind of siutation is to run a query in SQL that
has the exact string that I'm using in the vb dataset. If that returns data
then its likely the dataset configuration that is at fault. If no data is
returned then it'll be the query string itself that's at fault. I suggest
that you try the query outside of Crystal and VB to be sure it will return
data. If it does return data then there will be something not quite right
with the dataset configuration in vb

Regards

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top