このコードの何が問題なのですか:
ReportDocument cryrpt = new ReportDocument();
TableLogOnInfos crtablelogoninfos = new TableLogOnInfos();
TableLogOnInfo crtablelogoninfo = new TableLogOnInfo();
ConnectionInfo crconnectioninfo = new ConnectionInfo();
Tables CrTables;
cryrpt.Load("C:\\Documents and Settings\\Administrator\\Desktop\\minfatora11-7--\\minfatora\\minfatora\\Treasury_account_out_come.rpt");
crconnectioninfo.ServerName = "localhost";
crconnectioninfo.DatabaseName = "MNFATOR";
crconnectioninfo.UserID = "ICMADMIN";
crconnectioninfo.Password = "ICMADMIN";
CrTables = cryrpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
cryrpt.RecordSelectionFormula = "select * from tblxxx where xxx=2";
cryrpt.Refresh();
allReportViewer.ReportSource = cryrpt;
「オブジェクト参照がオブジェクトのインスタンスに設定されていません」というエラーが表示されます。行で:
CrTable.ApplyLogOnInfo(crtableLogoninfo);