//申明创建的DataSet的VIEW_WY_TENDataTable对象
EstateInfo.EIWEB.Develop.Report.Ten.Five.DataSet.VIEW_KF_TEN_FIFTHDataTable ds = new DataSet.VIEW_KF_TEN_FIFTHDataTable();
//组建SQL
string strSQL = "SELECT v1.N1, v1.N2, v1.N3, v1.N4, v1.N5, v1.N6, v1.N7, v1.N8,v1.N9,v1.N10,v1.N11,v1.N12,v1.N13,v1.N14,v1.N15 "
+ "FROM VIEW_KF_TEN_FIFTH v1";
//创建数据库连接
OracleConnection conn = new OracleConnection(EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString());
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
OracleDataAdapter ad = new OracleDataAdapter();
cmd.CommandText = strSQL;
ad.SelectCommand = cmd;
ad.Fill(ds);
//创建所画的报表对象
EstateInfo.EIWEB.Develop.Report.Ten.Five.FiveXtraReport obj = new FiveXtraReport();
obj.DataSource = ds;
obj.DataMember = "VIEW_KF_TEN_FIFTH";
return obj;
Fill: SelectCommand.Connection 属性尚未初始化。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.InvalidOperationException: Fill: SelectCommand.Connection 属性尚未初始化。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[InvalidOperationException: Fill: SelectCommand.Connection 属性尚未初始化。]
ReportMessageBox.ShowException(Exception e, UserLookAndFeel lookAndFeel, IWin32Window owner, String text, String caption) +52
ReportMessageBox.ShowException(Exception e, UserLookAndFeel lookAndFeel, String text, String caption) +15
DevExpress.XtraReports.UI.XtraReportBase.FillDataSet() +186
DevExpress.XtraReports.UI.XtraReport.OnBeforePrint(PrintEventArgs e) +108
DevExpress.XtraReports.UI.XtraReport.CreateDocument(Single progressRange) +47
DevExpress.XtraReports.UI.XtraReport.CreateDocument() +6
DevExpress.XtraReports.Web.ReportViewer.ForcePSDocument() +62
DevExpress.XtraReports.Web.ReportViewer.OnPreRender(EventArgs e) +17
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
何解?
11 个解决方案
#1
SelectCommand cmd没有指定Connection ,或者是没打开数据库
Connection conn = new Connection(ConnectionText) ;
SelectCommand.Connection = conn ;
conn.Open() ;
SelectCommand.ExecuteNonQuery() ;
conn.Close() ;
Connection conn = new Connection(ConnectionText) ;
SelectCommand.Connection = conn ;
conn.Open() ;
SelectCommand.ExecuteNonQuery() ;
conn.Close() ;
#2
打开了数据库的
OracleConnection conn = new OracleConnection(EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString());
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
OracleDataAdapter ad = new OracleDataAdapter();
cmd.CommandText = strSQL;
ad.SelectCommand = cmd;
ad.Fill(ds);
#3
没人来?
#4
你断点看看你的conn..
#5
EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString()
断点看这个读出来的值是什么
#6
EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString() 值是什么
#7
Data Source=orcl147;User Id=NYEIWEB;password=NYEIWEB;
没问题啊!!!
没问题啊!!!
#8
解决啦
原来是web.config里少了2行代码
原来是web.config里少了2行代码
<add name="ConnectionString" connectionString="Data Source=ORCL147;Persist Security Info=True;User ID=ZZ0309;Password=ZZ0309;Unicode=True" providerName="System.Data.OracleClient"/>
<add name="ConnectionString2" connectionString="Data Source=ORCL147;Persist Security Info=True;User ID=ZZ0309;Password=ZZ0309;Unicode=True" providerName="System.Data.OracleClient"/>
#9
可以结贴啦。。
#10
#11
来晚了一点点。。
#1
SelectCommand cmd没有指定Connection ,或者是没打开数据库
Connection conn = new Connection(ConnectionText) ;
SelectCommand.Connection = conn ;
conn.Open() ;
SelectCommand.ExecuteNonQuery() ;
conn.Close() ;
Connection conn = new Connection(ConnectionText) ;
SelectCommand.Connection = conn ;
conn.Open() ;
SelectCommand.ExecuteNonQuery() ;
conn.Close() ;
#2
打开了数据库的
OracleConnection conn = new OracleConnection(EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString());
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
OracleDataAdapter ad = new OracleDataAdapter();
cmd.CommandText = strSQL;
ad.SelectCommand = cmd;
ad.Fill(ds);
#3
没人来?
#4
你断点看看你的conn..
#5
EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString()
断点看这个读出来的值是什么
#6
EstateInfo.OracleDAL.OraHelper.CONN_STRING.ToString() 值是什么
#7
Data Source=orcl147;User Id=NYEIWEB;password=NYEIWEB;
没问题啊!!!
没问题啊!!!
#8
解决啦
原来是web.config里少了2行代码
原来是web.config里少了2行代码
<add name="ConnectionString" connectionString="Data Source=ORCL147;Persist Security Info=True;User ID=ZZ0309;Password=ZZ0309;Unicode=True" providerName="System.Data.OracleClient"/>
<add name="ConnectionString2" connectionString="Data Source=ORCL147;Persist Security Info=True;User ID=ZZ0309;Password=ZZ0309;Unicode=True" providerName="System.Data.OracleClient"/>
#9
可以结贴啦。。
#10
#11
来晚了一点点。。