Hello,
Thanks for the help....
Following is my full code...
Pls help me..
Imports System.Data
Imports System.Data.Odbc
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class WebForm5
Inherits System.Web.UI.Page
Private ConnStr As String
Private Conn As System.Data.Odbc.OdbcConnection
Private Comm As System.Data.Odbc.OdbcCommand
Private DataAdpt As System.Data.Odbc.OdbcDataAdapter
Private DataRead As System.Data.Odbc.OdbcDataReader
Dim MyReport As New ReportDocument
'Dim MyReport As New CrystalReport1
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private LogInfo As New TableLogOnInfo
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents lstPO As System.Web.UI.WebControls.DropDownList
Protected WithEvents CrystalReportViewer1 As
CrystalDecisions.Web.CrystalReportViewer
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ConnStr = "DSN=TGGSYSTEMDSN;Driver={Microsoft ODBC for
ORACLE};Server=TGG.world;Uid=CS22USER;Pwd=CS22USER;"
Conn = New Odbc.OdbcConnection(ConnStr)
Conn.Open()
If Me.IsPostBack = False Then
FillPOList()
End If
End Sub
Private Sub FillPOList()
lstPO.Items.Clear()
Dim SelectSQL As String
SelectSQL = "Select DISTINCT K_PO_NUM FROM PO_DETAILS"
Dim Conn As New Odbc.OdbcConnection(ConnStr)
Dim Comm As New Odbc.OdbcCommand(SelectSQL, Conn)
Try
Conn.Open()
DataRead = Comm.ExecuteReader()
Do While DataRead.Read
Dim Newitem As New ListItem
Newitem.Text = DataRead("K_PO_NUM")
lstPO.Items.Add(Newitem)
Loop
DataRead.Close()
Catch ex As Exception
Finally
If (Not Conn Is Nothing) Then
Conn.Close()
End If
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim USERID As String = "CS22USER"
Dim PW As String = "CS22USER"
If (Not Me.IsPostBack) Then
MyReport.SetDatabaseLogon(USERID, PW)
Else
Session("MyReport") = MyReport
MyReport.Load("C:\Inetpub\wwwroot\TGG\CrystalReport4.rpt")
MyReport.SetDatabaseLogon(USERID, PW)
MyReport.DataDefinition.RecordSelectionFormula =
"{PO_DETAILS.K_PO_NUM}= '" & lstPO.SelectedItem.Value & "'"
CrystalReportViewer1.ReportSource = MyReport
End If
End Sub
End Class