使用vb.Net的Windows应用程序Crystal Report
问题描述:
我试图用一些特定数据填充水晶报告,但它会显示数据库表的所有数据
I m trying to fill crystal report with some specific data but it will show all the data of the database table
Try
Dim cryRpt As New ReportDocument
With cryRpt
Dim str As String = "E:\barodra\baroda\WindowsApplication1\CrystalReport1.RPT"
.Load(str)
Dim query As String = "SELECT * FROM snc WHERE no='" & TextBox2.Text & "' "
da = New OleDbDataAdapter(query, con)
Dim cb As New OleDbCommandBuilder(da)
Dim ds As New DataSet()
da.Fill(ds)
.SetDataSource(ds)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End With
Catch ex As Exception
Dim msg As String = ex.Message
End Try
答
我认为上面的代码有两个问题
1.检查你的cryRpt对象
2.检查.rpt文件的数据集名称和配置
I think above code having two problem
1. check your cryRpt object
2. check dataset name and configuration of .rpt file
I * n选择查询仅提及你想要的那些参数
egSELECT EMPFIRSTNAME,EMPLASTNAME FROM Employee而不是SELECT * FROM .....
休息你的代码是正确的..我在猜...所以试试这个
I*n Select query mention only those parameter that which you want
e.g.SELECT EMPFIRSTNAME,EMPLASTNAME FROM Employee instead of SELECT * FROM.....
Rest your code is correct ..i am guessing...So try this
我很抱歉我认为..的栏目
但你可以查看这个链接
www .aspsnippets.com / Articles / Filter-GridView-with-TextBox-using-FilterExpression-in-SqlDataSource-in-ASPNet.aspx
你在这里设置而不是gridview你可以使用reportviewer obj
它可能对你有所帮助
I am sorry i thought ..its column
but u can chk this link
www.aspsnippets.com/Articles/Filter-GridView-with-TextBox-using-FilterExpression-in-SqlDataSource-in-ASPNet.aspx
You set here instead of gridview you can use reportviewer obj
it may b helpful to you