Friday, March 23, 2012

Report Viewer - add table

Is it possible to add tables (like in the report editor) programmatically to a report ?

I want to use 1 report for an infinite number of datatables.

Hi Friend,

I think this will give you some idea....... Thanks

publicvoid logonInfo()

{

TableLogOnInfo logOnInfo =newTableLogOnInfo();

logOnInfo = oRpt.Database.Tables["<table>"].LogOnInfo;

logOnInfo.ConnectionInfo.ServerName ="<name of Server>";

logOnInfo.ConnectionInfo.DatabaseName ="<name of DB>";

logOnInfo.ConnectionInfo.UserID ="<user>";

logOnInfo.ConnectionInfo.Password ="<pwd>";

logOnInfo.TableName ="<table>";TableLogOnInfos infos =newTableLogOnInfos();

infos.Add(logOnInfo);

CrystalReportViewer1.LogOnInfo = infos;

}

Thank you for reading my reply.

HGONE

|||

Sorry, I forgot to metion that I am using the Microsoft Reports , not Crystal Reports.

Thanks for the reply though!

Drew

No comments:

Post a Comment