EDN Admin
Well-known member
Dear experts, please help. I am stuck i dont what i am doing wrong.
I am trying to Access a Crystal Report in my VB.Net application. But database logon dialog box is keep appearing. My Code is as follows, Dim objFunctions = New Indent.Functions
Dim PP As New ReportViewer()
Dim fromDate As String
Dim toDate As String
fromDate = dt1.Text
toDate = dt2.Text
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
rpt = New Aesl_QuoteOrders_MajorCode_Sales
For Each tbCurrent In rpt.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = "PSQPSQ2010"
.UserID = "sa"
.Password = "qwer1234"
.DatabaseName = "TWO"
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
Below is my report name
rpt.Load("Aesl_QuoteOrders_MajorCode_Sales.rpt")
I have following two parameters in my crystal report
Dim dtReport As New DataTable
Dim SPParameters(2) As SqlParameter
SPParameters(0) = New SqlParameter("@dt_FrmDate", fromDate)
SPParameters(1) = New SqlParameter("@dt_ToDate", toDate)
My crystal report is linked with Store procedure ... so i am using following line to execute the stored procedure on my Parameters
dtReport = objFunctions.ExecuteSpDataTable("TWO..aesl_MajorCode_QuoteOrders", SPParameters)
rpt.SetDataSource(dtReport)
Dim parameterList As ParameterFieldDefinitions = rpt.DataDefinition.ParameterFields
If (parameterList.Count > 0) Then
rpt.SetParameterValue(parameterList(0).ParameterFieldName, fromDate)
rpt.SetParameterValue(parameterList(1).ParameterFieldName, toDate)
End If
PP.CrystalReportViewer.ReportSource = rpt
PP.Show()
View the full article
I am trying to Access a Crystal Report in my VB.Net application. But database logon dialog box is keep appearing. My Code is as follows, Dim objFunctions = New Indent.Functions
Dim PP As New ReportViewer()
Dim fromDate As String
Dim toDate As String
fromDate = dt1.Text
toDate = dt2.Text
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
rpt = New Aesl_QuoteOrders_MajorCode_Sales
For Each tbCurrent In rpt.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = "PSQPSQ2010"
.UserID = "sa"
.Password = "qwer1234"
.DatabaseName = "TWO"
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
Below is my report name
rpt.Load("Aesl_QuoteOrders_MajorCode_Sales.rpt")
I have following two parameters in my crystal report
Dim dtReport As New DataTable
Dim SPParameters(2) As SqlParameter
SPParameters(0) = New SqlParameter("@dt_FrmDate", fromDate)
SPParameters(1) = New SqlParameter("@dt_ToDate", toDate)
My crystal report is linked with Store procedure ... so i am using following line to execute the stored procedure on my Parameters
dtReport = objFunctions.ExecuteSpDataTable("TWO..aesl_MajorCode_QuoteOrders", SPParameters)
rpt.SetDataSource(dtReport)
Dim parameterList As ParameterFieldDefinitions = rpt.DataDefinition.ParameterFields
If (parameterList.Count > 0) Then
rpt.SetParameterValue(parameterList(0).ParameterFieldName, fromDate)
rpt.SetParameterValue(parameterList(1).ParameterFieldName, toDate)
End If
PP.CrystalReportViewer.ReportSource = rpt
PP.Show()
View the full article