I found the error,
that was because of the path of the database file was tooooooooooooo long:
"D:\Documents and Settings\Eihab.BENHA-7105CAE04\My Documents\Visual Studio
Projects\CSharp Projects\My Database Projects\Crystal Reports Projects\Chapter02
\CustomerListing\PhoneIndex.mdb"
and it works with me now, but a new problem arises:
I specify the data source when I make the report, and on the output the whole database is
displayed, but what if I want to filter it, something like:
"select * from phoneIndex where area = 'cairo'" ?
of course I can make the query at the design time of the report, but no, I want to make
it at the run time to enable the user to search the index.
I tried to get the search subset nad bind it to a ReportDocument Object, but I still get
the full records of the database:
////////////////////////////////////////////////////////////////
string connectionString = "provider=Microsoft.JET.OLEDB.4.0; "
+ "data source = .\\phoneindex.mdb";
string commandString = "select * from PhoneIndex where area = 'cairo'";
dataAdapter = new OleDbDataAdapter(commandString, connectionString);
dataSet = new DataSet();
dataAdapter.Fill(dataSet);
reportDocument1 = new CrystalDecisions.CrystalReports.Engine.ReportDocum ent();
string path = @"D:\Documents and Settings\Eihab.BENHA-7105CAE04\My Documents\Visual Studio Projects\CSharp Projects\My Database Projects\Crystal Reports Projects\Chapter02\CustomerListing\CrystalReport1. rpt";
reportDocument1.Load(path);
reportDocument1.SetDataSource(dataSet);
reportDocument1.Refresh();
crystalReportViewer1.ReportSource = reportDocument1;
////////////////////////////////////////////////////////////////
I hope to get help from you how can I do that, thanks a lot.
|