Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi guys

 

I am new with crystal reports and i am trying to load a crystal report wirh data . What i want is to display just one record on the crystal report. I want a user to enter say a customer name then using an sql string the record is searched from the database and displayed on textboxes as well as on a crystal report. I cant seem to get it to display the record on the cryatal report. i have a crystal reportviewer on the from.(vb.net 2003 and Access database)

 

 

this is the code am using

Dim uname As String = txtcustomerid.Text

Dim connString As String = "Provider=Microsoft.Jet.oledb.4.0;Data source=D:\Documents and Settings\bob\My Documents\VB\Soldiers Of Christ\bin\S.O.C.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection
myConnection.ConnectionString = connString

Dim da As OleDbDataAdapter = New OleDbDataAdapter("select * from SOCcustomerdetails where Customernumber = " & uname & "", myConnection)

Dim ds As DataSet = New DataSet
     
da.Fill(ds, "SOCcustomerdetails")
Dim x As New CrystalReport2
x.SetDataSource(ds)
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.ReportSource = x

Thanks

Edited by PlausiblyDamp
Posted
No its not too late to reply. Anyway I still havent found a way around it. And yes, i have set the database fields on the crystal reports right.
Posted

The only way I have ever got it to work is to set the datasource on each table in the report.

 

x.Database.Tables[0].SetDataSource(TableName);

 

There might be another way to do it, I have been using this since the first VS.NET as there was a know bug and haven't looked into it since, to lazy I guess :o

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...