CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0])问题!!!
请各位老大指点迷津!
protected void Button_push_Click(object sender, EventArgs e)
{
string sql = "SELECT * FROM csj_wx ";
string DBConfig_sql = @ "Data Source=SKY-0EKQQVVJ0ON;Initial Catalog=yangtze;User ID=sa;Password=hp1502... ";
//DataSet ds = new DataSet();
DataSet ds = RunQuery(sql);
SqlConnection sqlCon = new SqlConnection(DBConfig_sql);
SqlCommand sqlCmd = new SqlCommand(sql, sqlCon);
SqlDataAdapter sqlAd = new SqlDataAdapter();
sqlAd.SelectCommand = sqlCmd;
sqlAd.Fill(ds,sql);
//Response.Write( " <script> alert( 'ok........... '); </ script> ");
CrystalReportSource1.ReportDocument.Load(Server.MapPath( "CrystalReport.rpt "));
if (ds.Tables[0].Rows.Count> 0){
try{
//ReportDocument rd = new ReportDocument();
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);//这里出错!!!!就是没有数据,ds返回是有数据集的
//CrystalReportViewer1.ReportSource=ds;
CrystalReportSource1.DataBind();
}
catch{
Response.Write( "没有满足您查询条件的数据,请重新输入查询条件! " + ds.Tables[0].Rows.Count);
}
}
CrystalReportViewer1.ReportSource =