Im try your method in the past, but it never function with me.

So i found a better solution:

*//load my form and create a ReportDocument instance*
frmRelatorio fr = new frmRelatorio();
ReportDocument rptDoc = new ReportDocument();

*//load de RPT file*
rptDoc.Load(Core.pastaLocal + @"Relatórios\balanco_contas.rpt");

*//create my object that will return de dataSet to me*
BalancoContas cr = new BalancoContas();

*//call the method that return a dataset to me and fill the first table of
my report (0)*
rptDoc.Database.Tables[0].SetDataSource(cr.listarRelatorio());

fr.rptViewer.ReportSource = rptDoc;

*//show the form with crystal reports viewer*
fr.ShowDialog();

------------------------------------------------------------------------------------------------------------------------

To do it, you need create a new DataSet from file -> new -> dataset.

Put the columns like your database table.

Fill the first table of your reports (table 0):
rptDoc.Database.Tables[0].SetDataSource( <your dataset here> );

Set the crystal report document to crystal reports reportSource:
form.rptViewer.ReportSource = rptDoc;

To simple.

Cya.


2008/12/1 [EMAIL PROTECTED] <[EMAIL PROTECTED]>

>
> Hey!
> I'm developing a Crystal Reports-Page in Visual Studio 2008 with C#
> and a weird error shows up all the time. I searched Google and found a
> lot of people with the same errors but no one had a solution for this.
>
> When I submit the form and fill the data into a datatable & a dataset
> the first of two reports on the page loads perfectly but the second
> report on the page comes up with the following error:
>
> Logon failed. Details: crdb_adoplus : Object reference not set to an
> instance of an object. Error in File [...]\Temp\temp_05e54150-
> b4f5-427a-848f-4b402f507daf
> {3F31E28C-9C91-47B8-84AB-95831FAB3419}.rpt: Unable to connect:
> incorrect log on parameters.
>
>
> As soon as I try to export the working report via the EXPORT button,
> it comes up with the same error.
>
> Parts of my C#-Code:
>
> CrystalReport1 cr = new CrystalReport1();
>            cr.SetDatabaseLogon("ccc", "ddd");
>            cr.Load(Server.MapPath("~\\CrystalReport1.rpt"));
>            cr.SetDataSource(DataSet1);
>            CrystalReportViewer1.ReportSource = cr;
>
>            CrystalReport1 cr2 = new CrystalReport1();
>            cr2.SetDatabaseLogon("aaa", "bbb");
>            cr2.Load(Server.MapPath("~\\CrystalReport1.rpt"));
>            cr2.SetDataSource(DataSet2);
>            CrystalReportViewer2.ReportSource = cr2;
>
>
>
> Can anybody help me? I've been wasting a lot of time on this problem
> without any solution...
>
> Thanks a lot
> -r.
>



-- 
Atenciosamente,
Paulo Coutinho.
Site: www.prsolucoes.com
Msn:  [EMAIL PROTECTED]
Skype: paulo.prsolucoes

Reply via email to