I dropped a viewer on a form.
here's the code for my form that pulls three sprocs into a dataset and
binds it to the report:
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();
// create an instance of our strongly typed dataset and
// fill it with data from the database
Dataset1 ds = new Dataset1();
SqlConnection conn = new SqlConnection(
"workstatio n id=HTKENWS;pack et size=4096;integ rated security=SSPI;" +
"data source=\"HTKENW S\\SPAMSPAM\";p ersist security info=True;initi al
catalog=pubs");
SqlDataAdapter da1 = new SqlDataAdapter(
"exec getauthors", conn);
SqlDataAdapter da2 = new SqlDataAdapter(
"exec gettitleauthors ", conn);
SqlDataAdapter da3 = new SqlDataAdapter(
"exec gettitles", conn);
da1.Fill(ds,"ge tauthors");
da2.Fill(ds,"ge ttitleauthors") ;
da3.Fill(ds,"ge ttitles");
// instantiate our report and bind bind the strongly typed dataset to it
CrystalReport1 rpt = new CrystalReport1( );
rpt.Database.Ta bles[0].SetDataSource( ds);
// bind the report instance to the gui
crystalReportVi ewer1.ReportSou rce = rpt;
rpt.PrintToPrin ter(1,true,1,2) ;
}
"Khurram Lone" <kh*********@ho tmail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Ken,
What I am trying to do is something very basic. I created a blank
crystal report. Then I created a recordset with a query to the database.
I checked that the recordset was populated. Then I called the
SetRecordSet method of the Crystal Report object. When I displayed the
report in the report viewer, it came up blank.
I was not sure that a blank report could be bound to a recordset, so I
created another report which I bound to a database table. Then I did a
query on that same database table, created a recordset, and passed that
recordset to the report object. The recordset was populated with the
same fields as the report. The fill method of the dataadapter has the
exact same table name as the report.
The report came up in the report viewer populated by the entire table,
once again as if the recordset had not been sent to the report.
Thanks
Khurram
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!