Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report DataSet at runtime Post Reply Post New Topic
Author Message
kmr.siva
Newbie
Newbie


Joined: 01 Sep 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 4
Quote kmr.siva Replybullet Topic: Crystal Report DataSet at runtime
     Posted: 01 Sep 2009 at 11:07pm
hi,

i am creating a dataset from different tables data at runtime. and i want to set this to my crystal report, but it is not working properly. i am posting my code, please go through it.

strSQL = "SQL Query String to Select data from different tables using InnerJoin "
SQLCNN = "my data connection string"

Dim cmd As New SqlCommand(strSQL, SQLCNN)
Dim DA As New SqlDataAdapter(cmd)
Dim DS As New DataSet

DA.Fill(DS)

rptDocument.Load(strReportName)
rptDocument.SetDataSource(DS)
rptDocument.Refresh()
crViewer.ReportSource = rptDocument
crViewer.RefreshReport()

In my dataset i am getting the desired records, but in report it is showing the records generated at design time

Please advise, where i am wrong.

thanks in advance
Kumar
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Sep 2009 at 6:19am
what type of data connection is the report using?  I use ado.net, and what you have should work.
IP IP Logged
kmr.siva
Newbie
Newbie


Joined: 01 Sep 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 4
Quote kmr.siva Replybullet Posted: 02 Sep 2009 at 8:34am
I am using OLE DB Provider for SQL Server for crystal report. and crystal report version is 2008. Visual Studio 2008.
Kumar
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Sep 2009 at 10:55am
I don't know, can you set the datasource in an OLE DB connection?  I would think that you would call a stored proc using OLE DB...at least that is the only way that I have used it.
 
I've been wrong before...
IP IP Logged
kmr.siva
Newbie
Newbie


Joined: 01 Sep 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 4
Quote kmr.siva Replybullet Posted: 04 Sep 2009 at 11:44pm
In my VB.net code i am using ADO.net for connection. My real problem is, if am selecting data for the report from one table only, then the above code will work, if it is more than one table report is showing the records that is showing at the time of creating the table. So i specified the table names in "setdatasource" method then then issue is - records are duplicating.... what can be the reason? Please help me....

if required i an post more code details

Kumar
IP IP Logged
kmr.siva
Newbie
Newbie


Joined: 01 Sep 2009
Location: Saudi Arabia
Online Status: Offline
Posts: 4
Quote kmr.siva Replybullet Posted: 07 Sep 2009 at 4:28am
I found solution for this, i used typed dataset now its working
Kumar
IP IP Logged
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