[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 ?
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
Re: Record Selection according to Textbox value
what should i declare cr as ??? and where should both the codes be written ?
Re: Record Selection according to Textbox value
I have used the following code:
vb Code:
Private Sub OrderForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cr As New ReportDocument
ConfigureCrystalReports()
cr.RecordSelectionFormula = "{orderform.orderno}='" & Booking.TextBox1.Text & "'"
End Sub
It gives me "invalid report file path" error.
Re: Record Selection according to Textbox value
It looks like you need to set the Reportsource property of your reportdocument object.
Re: Record Selection according to Textbox value
i have done that too... it did nt work !