Print Page | Close Window

connect crystal report to ado.net dataset

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
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=5943
Printed Date: 26 Apr 2024 at 6:11am


Topic: connect crystal report to ado.net dataset
Posted By: tornado_12
Subject: connect crystal report to ado.net dataset
Date Posted: 31 Mar 2009 at 5:51am
hi everyone
 i did created an ado.net dataset and put four tables in it. i set it as the data source for my crystal report form but when i run my application i get nothing this is my code please helpCry
 
code
 

Open_Con()'open database connection

Dim cryRpt10 As New ReportDocument

cryRpt10.Load(Application.StartupPath & "\test10.rpt")

Dim ds As New Mydataset

Dim SQLa As String = "SELECT table1.Num,table2.name,table3.name,table1.Date,table4.Date,table4.prise from table2 INNER JOIN (table1 INNER JOIN (table4 INNER JOIN table3 on table4.code=table3.code)on table1.Num=table4.Num) ON table2.Codef=table1.Codef where table1.Num= " & n & ""

'n as integer (number)

Dim DataAdapter As New OleDbDataAdapter(SQLa, Con)

DataAdapter.Fill(ds)

cryRpt10.SetDataSource(ds)

Close_Con()'close database connection

form1.CrystalReportViewer1.ReportSource = cryRpt10

form1.CrystalReportViewer1.Refresh()

form1.Show()

thinks for your suggestions




Replies:
Posted By: dazel
Date Posted: 02 Apr 2009 at 2:59am
hi,
   what ever you have done is correct but is incomplete.
   Continue with these steps.
 
Adding .xsd file to project, then create datatables in your XSD file.(you can google about how to  add datatable to your XSD file)
 
Map the tables with Crystal Report by following the wizard to create crystal report.
 
Also remember to copy your dataset data i.e. 'ds' to the XSD's datatable.
this link can help you.
 
http://www.codeproject.com/KB/grid/Crystal_Report__90.aspx?display=Print - http://www.codeproject.com/KB/grid/Crystal_Report__90.aspx?display=Print



Print Page | Close Window