Results 1 to 6 of 6

Thread: [RESOLVED] Record Selection according to Textbox value

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Resolved [RESOLVED] Record Selection according to Textbox value

    I am working with Crystal Reports XI along with VS2005. I am opening my report document from the CrystalReportsViewer.

    Following is the code for it:

    Code:
    Option Strict On
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    
    Public Class OrderForm
    
        Private Sub OrderForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ConfigureCrystalReports()
        End Sub
    
        Private Sub ConfigureCrystalReports()
            Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
            myConnectionInfo.ServerName = "xxxx"
            myConnectionInfo.DatabaseName = "xxxx"
            myConnectionInfo.UserID = "xxxxx"
            myConnectionInfo.Password = "xxxxx"
    
            SetDBLogonForReport(myConnectionInfo)
    
        End Sub
        Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
    
            Dim myTableLogOnInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo()
            For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
                myTableLogOnInfo.ConnectionInfo = myConnectionInfo
            Next
    
        End Sub
    End Class
    Now, i want to open the record from the table 'Order' (which is in Oracle DB) where the orderno is equal to the textbox value in my OrderBooking.vb. Where should i pass the SQL command ? in the CR or VB ?
    Last edited by LuxCoder; Aug 1st, 2007 at 06:32 AM.

  2. #2
    Addicted Member mabbas110's Avatar
    Join Date
    Oct 2005
    Location
    Karachi , Pakistan
    Posts
    172

    Re: Record Selection according to Textbox value

    for example that field in report is textbox

    so u will do the following

    cr.selectionformula="{Report1.textbox}='"& textbox1.text &"'

    if it does not work then let me know
    Thanks and Regards,

    Muhammad Abbas

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Record Selection according to Textbox value

    what should i declare cr as ??? and where should both the codes be written ?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Record Selection according to Textbox value

    I have used the following code:

    vb Code:
    1. Private Sub OrderForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim cr As New ReportDocument
    3.         ConfigureCrystalReports()
    4.         cr.RecordSelectionFormula = "{orderform.orderno}='" & Booking.TextBox1.Text & "'"
    5.     End Sub

    It gives me "invalid report file path" error.

  5. #5
    New Member
    Join Date
    May 2007
    Location
    Columbus, Ohio
    Posts
    5

    Re: Record Selection according to Textbox value

    It looks like you need to set the Reportsource property of your reportdocument object.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Record Selection according to Textbox value

    i have done that too... it did nt work !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width