H
hhmyz
Unregistered / Unconfirmed
GUEST, unregistred user!
求教各位,实在解决不了,查了资料也没用。另问题总计200分,分开给分。
1、
objconnstr = new SqlConnection(ConfigurationManager.ConnectionStrings["objConnStr"].ToString());
DataSet objdataset = new DataSet();
DataSet1 objdataset1 = new DataSet1();//xsd型
SqlDataAdapter objdataadapter = new SqlDataAdapter(Convert.ToString(Session["sqlstr"]), objconnstr);
objconnstr.Open();
objdataadapter.Fill(objdataset);
objdataadapter.Fill(objdataset1);
objconnstr.Close();
objdataadapter = null;
apcdstalrpt.Load("kk.rpt");
apcdstalrpt.SetDataSource(objdataset);
//apcdstalrpt.Refresh();
CrystalReportViewer1.ReportSource = apcdstalrpt;
//CrystalReportViewer1.DataBind();加不加一样
this.GridView1.DataSource = objdataset1;
this.GridView1.DataBind();
objdataset = null;
objdataset1=null;
测试数据集都能返回sql语句值,但水晶报表取数据不是sql语句里的,取的是作好的kk.rpt的
2、
类似于select * from table1可得到数据集,
但用exec(@sqlstr)方式得不到数据集,
declare @sqlstr varvhar(4000)
set @sqlstr='select * into #kkkk from table1 select * from #kkkk'
exec(@sqlstr)
此时数据集里是@sqlstr 的值'select * into #kkkk from table1 select * from #kkkk',
而不是select * from #kkkk查看的数据集。
试了几种调用方法都不行。
1、
objconnstr = new SqlConnection(ConfigurationManager.ConnectionStrings["objConnStr"].ToString());
DataSet objdataset = new DataSet();
DataSet1 objdataset1 = new DataSet1();//xsd型
SqlDataAdapter objdataadapter = new SqlDataAdapter(Convert.ToString(Session["sqlstr"]), objconnstr);
objconnstr.Open();
objdataadapter.Fill(objdataset);
objdataadapter.Fill(objdataset1);
objconnstr.Close();
objdataadapter = null;
apcdstalrpt.Load("kk.rpt");
apcdstalrpt.SetDataSource(objdataset);
//apcdstalrpt.Refresh();
CrystalReportViewer1.ReportSource = apcdstalrpt;
//CrystalReportViewer1.DataBind();加不加一样
this.GridView1.DataSource = objdataset1;
this.GridView1.DataBind();
objdataset = null;
objdataset1=null;
测试数据集都能返回sql语句值,但水晶报表取数据不是sql语句里的,取的是作好的kk.rpt的
2、
类似于select * from table1可得到数据集,
但用exec(@sqlstr)方式得不到数据集,
declare @sqlstr varvhar(4000)
set @sqlstr='select * into #kkkk from table1 select * from #kkkk'
exec(@sqlstr)
此时数据集里是@sqlstr 的值'select * into #kkkk from table1 select * from #kkkk',
而不是select * from #kkkk查看的数据集。
试了几种调用方法都不行。