Hi,
I've generated a report using crystal report 9.0 and VB.net.The database I used MS Access 2003.To Generate this report I've used query in MS Aceess and I've passed the two parameters as "year" and "month".
When I get the preview from thr crystal rport I canget the out put preview.But When I going to run the program through the Visual Studio.net, It says an error.
This is the code I wrote.
Dim objPaySummaryRpt As New PayrollSummery
Dim intMonth, intYear As Integer
intMonth = cmbMonth.SelectedValue
intYear = cmbYear.SelectedValue
Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim crConnectionInfo As New ConnectionInfo()
Dim crTableLogOnInfo As New TableLogOnInfo()
'------------------
Dim MyCon As OleDb.OleDbConnection
MyCon = New OleDb.OleDbConnection
MyCon.ConnectionString = System.Configuration.ConfigurationManager.Connecti onStrings("Pay_Roll_System.My.MySettings.payrollCo nnectionString").ConnectionString
MyCon.Open()
'------------------
crConnectionInfo.ServerName = MyCon.DataSource
crConnectionInfo.DatabaseName = MyCon.Database
crConnectionInfo.UserID = ""
crConnectionInfo.Password = ""
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
crDatabase = objPaySummaryRpt.Database
crTables = crDatabase.Tables
For Each crTable As CrystalDecisions.CrystalReports.Engine.Table In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
---------------------------------------------------
objPaySummaryRpt.SetParameterValue("AmountMonth", intMonth)
objPaySummaryRpt.SetParameterValue("AmountYear", intYear)
objPaySummaryRpt.SetParameterValue("QRMonth", intMonth)
objPaySummaryRpt.SetParameterValue("QRYear", intYear)
objPaySummaryRpt.SetParameterValue("User", frmLogin.strUserName)
---------------------------------------------------
MyCon.Close()
crvPaySummary.ReportSource = objPaySummaryRpt
Error Msg is - "the Items Not found inthis collection"& "Query engine error"
I need to pass the values to the parameters in my queriy through the vb.net code.
Can someone please help me???