Click here to Skip to main content
15,900,482 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m trying to fill crystal report with some specific data but it will show all the data of the database table



VB
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
Posted
Updated 26-Sep-13 10:02am
v3

I think above code having two problem
1. check your cryRpt object
2. check dataset name and configuration of .rpt file
 
Share this answer
 
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
 
Share this answer
 
Comments
Member 9661672 26-Sep-13 5:58am    
But i have to select all colums
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
 
Share this answer
 
Comments
Member 9661672 26-Sep-13 7:36am    
i need to show data on crystal report where no=12
how can i do this??

Dim query As String = "SELECT * FROM snc WHERE no='" & TextBox2.Text & "' "
TextBox supplies no value
Member 9661672 27-Sep-13 2:49am    
please give me the solution of above question,its urgent?
indrajeet jadhav 27-Sep-13 3:27am    
What happens exactly..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900