Skip to Content
Former Member
Dec 01, 2011 at 05:40 AM

Crystal Report VS2008


Dear All,

I have created a crystal report from two tables, when i run crystal report it asks password.

When i create a report from one table it didn't ask for password.

How can i run report without passing password

Imports System.Data.OracleClient
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class frm_wo_byid_rep
    Private mydataset As DataSet
    Private myDA As OracleDataAdapter
    Private myDA1 As OracleDataAdapter
    Dim rpt As New wo_no_rep_byid
#Region "Constructors"
    Public Sub New(ByVal strTextBox As String)
        TextBox1.Text = strTextBox
        TextBox2.Text = strTextBox
    End Sub
#End Region
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrep.Click
        If TextBox1.Text = "" Or TextBox2.Text = "" Then
            MessageBox.Show("Please enter Wo No!", "PCHR", MessageBoxButtons.OK, MessageBoxIcon.Stop)
            Exit Sub
        End If
        'Dim PFD As ParameterFieldDefinition
        Dim PValues As ParameterValues
        Dim Parm As ParameterDiscreteValue

            myDA = New OracleDataAdapter("SELECT * FROM WO WHERE WO_NO= '" & TextBox1.Text & "'", ConnectionString)
            myDA1 = New OracleDataAdapter("SELECT * FROM ITEM WHERE item_code = '" & TextBox2.Text & "'", ConnectionString)
            Dim builder As OracleCommandBuilder = New OracleCommandBuilder(myDA)
            Dim builder1 As OracleCommandBuilder = New OracleCommandBuilder(myDA1)
            mydataset = New DataSet()
            myDA.Fill(mydataset, "WO")
            myDA1.Fill(mydataset, "WO")
            CrystalReportViewer1.ReportSource = rpt
            TextBox1.Visible = False
            TextBox2.Visible = False
            btnrep.Visible = False
            btnexit.Visible = False
            'Label1.Visible = False
            'Label2.Visible = False
            PValues = New ParameterValues
            'PFD = rpt.DataDefinition.ParameterFields.Item("User")
            Parm = New ParameterDiscreteValue
            Parm.Value = Username
            CrystalReportViewer1.DisplayGroupTree = False
        Catch Excep As Exception
            MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
    Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
        Dim a As Integer
        a = MessageBox.Show("Are you sure you want to exit????", "ITPCHR", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
        If a = vbYes Then
            Exit Sub
        End If
    End Sub
End Class