Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET/ Crstal Reports 2005 SetDataSource gives error

Status
Not open for further replies.

Smitha08

Programmer
Jan 31, 2008
19
US
Hi,

I am using VB.net 2005 and Crystal Reports 2005.
Schema is used using .xsd file. The order of the fields in .xsd is the same as i am using (select query )to get the recordset.

I am getting the error The data source object is not valid on the Report.SetDataSource() method and report is not loaded.

I have no idea why this error pops up..
Any ideas.


CODE BELOW


crpRep = New CrystalDecisions.CrystalReports.Engine.ReportDocument

crpRep.Load(Application.StartupPath & "\PrintChecks.rpt")
'crpRep = oprt
crpDatabase = crpRep.Database
crpTables = crpDatabase.Tables
crpTable = crpTables.Item("DT_PrintChecks")
crpTable.Location = Application.StartupPath & "\DS_PrintChecks.xsd"

crpTable.SetDataSource(mRS)

Thanks,
Smitha
 
I got the solution.. check this out

Dim OleDbDataAdapter As System.Data.OleDb.OleDbDataAdapter
Dim objDataTable As Data.DataTable
'Transfer data from recordset to Datatable
OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter()
objDataTable = New Data.DataTable("GLDist")
OleDbDataAdapter.Fill(objDataTable, mRS)

'Loading the reprot
crpRep.Load(strReportPath)
'Setting the datasource for the report
crpRep.SetDataSource(objDataTable)
'Opening the crysal viewer.
Dim frx As New frmCrViewer
frmCrViewer.Show()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top