Click here to Skip to main content
15,936,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All

I still create program with 2005
When i want show report with crystal report .
The data not show. :(
I use CR 9 for report.

This is my code

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.SqlClient
Public Class frmReport
    Dim MyTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim MyLogin As CrystalDecisions.Shared.TableLogOnInfo
    Dim rsAkses As ADODB.Recordset
    Dim RptUser As rptBeli
    Private Sub frmReport_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' Dim Ssql As String
        Dim strConnection As String = "server=posmi-child;database=IT_INVENTORY;uid=arjuna;pwd=wicaksono;"
        Dim Connection As New SqlConnection(strConnection)
        Dim strSQL As String = "Select * From T_PEMBELIAN WHERE NO_DOK='" & frmEquipment.TextBox1.Text & "'"
        Dim DA As New SqlDataAdapter(strSQL, Connection)
        Dim DS As New DataSet
        RptUser = New rptBeli
        For Each MyTable In RptUser.Database.Tables
            MyLogin = MyTable.LogOnInfo
            MyLogin.ConnectionInfo.Password = "wicaksono"
            MyLogin.ConnectionInfo.UserID = "arjuna"
            MyLogin.ConnectionInfo.ServerName = "POSMI-CHILD"
            MyLogin.ConnectionInfo.DatabaseName = "IT_INVENTORY"
        CS.SelectionFormula = "{T_PEMBELIAN.NO_DOK}='" & frmEquipment.TextBox1.Text & "'"
        CS.ReportSource = RptUser
    End Sub
End Class

If i give comment in line
CS.SelectionFormula = "{T_PEMBELIAN.NO_DOK}='" & frmEquipment.TextBox1.Text & "'"

the data show, if i give uncomment the data not show
what's wrong with my code
Please help me
thatraja 28-Jul-10 0:37am    
did you get any error?if then edit your question & mention it.
Sandeep Mewara 28-Jul-10 0:40am    
Why are you using a formula that is doing the same thing as you did in your query?

1 solution

Have a look here of how to create a Crystal Report with SelectionFormula:
Creating a Report with a Selection Formula[^]

Might be the text filter need to be in double quotes and not single.
Share this answer

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