帮忙看看,这样写为什么不行?SqlDataAdapter myCommand = new SqlDataAdapter("select * from table1",myConnection);
DataSet DS = new DataSet();
myCommand.Fill(DS,"table1");
CrystalReport1 oRpt = new CrystalReport1();
oRpt.SetDataSource(DS.Tables["table1"]);
CrystalReportViewer1.ReportSource = oRpt;
DataSet DS = new DataSet();
myCommand.Fill(DS,"table1");
CrystalReport1 oRpt = new CrystalReport1();
oRpt.SetDataSource(DS.Tables["table1"]);
CrystalReportViewer1.ReportSource = oRpt;
解决方案 »
- FileUpload控制显示的文件类型?
- 大半夜还有不辞劳苦的人吗?请教一个字符串分解的问题
- 【求助】怎么弹不出新的窗口????
- CheckBoxList 绑定后布对齐问题?在线等待
- WebForm相应的类的静态方法怎么调用?
- 如何获取客户端中指定域的Cookie?
- wangrenda(浪人),各位高手,快进来帮我看看啊,最后50分,全给了,55555555555!!!!!!!
- 这句sql语句怎么写,才能在查询分析器中运行
- 有成都的同行么?进来报个名吧
- 初学,请各位告知学习方法,或好的书和网站,
- 系统开发业务,有兴趣的朋友可以看看!!!
- asp.net中,怎么样获取一个文件夹下的所有文件和文件夹
Dim sRptFile As String
Dim oRpt As New ReportDocument ' create a reportDocument object first 'oRpt.Refresh() ' clear the old info
getAuthorData()
sRptFile = Server.MapPath("Report.rpt") ' assign the rpt file name , if in different directory , you must specify the absoluted URL
oRpt.Load(sRptFile)
oRpt.SetDataSource(getAuthorData) CRViewer.ReportSource = oRpt
'CrystalReportViewer1.DisplayGroupTree = False End Sub Private Function getAuthorData() As DataSet
Dim oDS As New DataSet
Dim oConn As New SqlConnection
oConn.ConnectionString = "server=你的SERVER;database=pubs;user=sa;pwd=sa"
oConn.Open() Dim oCmd As New SqlCommand
oCmd.CommandText = "select au_id,au_lname,au_fname,phone,address from authors"
oCmd.CommandType = CommandType.Text
oCmd.Connection = oConn Dim oAdapter As New SqlDataAdapter(oCmd) oAdapter.Fill(oDS) oCmd.Dispose()
oAdapter.Dispose()
oConn.Close()
oConn.Dispose()
oDS.Tables(0).TableName = "authors_tbl" ' Note' the table name must the same as the table name you specify in the xsd file Return oDS End Function