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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Crystal Report in ASP.NET

Status
Not open for further replies.

sfisher76

Programmer
Aug 2, 2001
3
US
I am trying to create a dynamic Crystal Report in ASP.NET. I know my SQL works and my database connection is correct, but when I display the page, the table is empty. All of the columns are displayed, but there is no data.

I have a DataSet file named DataSet1736.xsd with the XML representation of the query.

I have a Crystal Report file names CrystalReport1736.rpt which refers to DataSet1736.xsd.

In my aspx (c#) page I have the follwing code to create my dataset:

=============
OleDbDataAdapter myCommand = new OleDbDataAdapter(sql, dbConnection);
DataSet1736 ds = new DataSet1736();
CrystalReport1736 cr = new CrystalReport1736();

myCommand.Fill(ds);
cr.SetDataSource(ds);

CrystalReportViewer1.ReportSource = cr;
===========

"sql" is my sql select command.
"dbConnection" is my database connection.

Everything that I have read says that this should work, but I don't know why my table is empty.

If I do:

Response.Write(ds.GetXml());

I get a list of all the values that were selected (so I know the dataset is not empty).

Any help is greatly appreciated.

Thanks,
Steve
 
try giving the name of your table the same as the xls table. If it's a view or a stored procedure, do the same:

dataadapter1.fill(ds,"viewMyView");
or
dataadapter1.fill(ds,"tblMyTable");
or
dataadapter1.fill(ds,"spMyStoredProcedure");

I did it exactely like that and it works like a charm =)

good luck

Daren J. Lahey
Just another computer guy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top