I'm new in VB.NET and I want to pass the value from vb.net to crystal report. I have a problem that the "Enter Parameter Value" keep asking a value even in my code there's already a value.
When I remove this code I know "Enter Parameter Value" will prompt asking the insertquery and customer, but what happened is it's asking insertquery,customer,insertquery. IDK why insertquery again ask the values of the parameter.
report_Batch.SetParameterValue("insertquery", strSelect)
report_Batch.SetParameterValue("customer", strName)
can anyone help me why this "Enter Parameter value" dialog asking again the insertquery. Thanks
What I have tried:
Here's my code.
Dim report_Batch As New BILLINGRBatch
Dim strName As String = ""
Dim intId As Integer
Dim payFilter As String = ""
Dim dateFilter As String = ""
Dim strSelect As String = ""
For i As Integer = 0 To dgCustomer.Rows.Count - 1
If CBool(dgCustomer.Item(0, i).Value) = True Then
intId = dgCustomer.Item(1, i).Value
strName = Replace(Trim(dgCustomer.Item(2, i).Value), "'", "''")
If txtPayId.Text <> 0 Then
payFilter = " AND a.status = '" & txtPayId.Text & "'"
End If
If dtpFrom.Value <> dtpTo.Value Then
dateFilter = " AND (SELECT start_date FROM bill_transaction1 WHERE transaction_id = a.transaction_id) BETWEEN ''" & dtpFrom.Value.ToString("yyyy-MM-dd") & "'' AND ''" & dtpTo.Value.ToString("yyyy-MM-dd") & "''"
End If
strSelect &= "insert into @t (selected, customername,payFilter,dateFilter) select '" & intId & "','" & strName & "','" & payFilter & "','" & dateFilter & "' " & Chr(13)
End If
Next
For Each table As CrystalDecisions.CrystalReports.Engine.Table In report_Batch.Database.Tables
Dim logonInfo As CrystalDecisions.Shared.TableLogOnInfo = table.LogOnInfo
logonInfo.ConnectionInfo.ServerName = serverName
logonInfo.ConnectionInfo.DatabaseName = serverDB
logonInfo.ConnectionInfo.UserID = serverUser
logonInfo.ConnectionInfo.Password = serverPass
table.ApplyLogOnInfo(logonInfo)
Next
For Each subReport As ReportDocument In report_Batch.Subreports
For Each Table As Table In subReport.Database.Tables
Dim logonInfo As CrystalDecisions.Shared.TableLogOnInfo = Table.LogOnInfo
logonInfo.ConnectionInfo.ServerName = serverName
logonInfo.ConnectionInfo.DatabaseName = serverDB
logonInfo.ConnectionInfo.UserID = serverUser
logonInfo.ConnectionInfo.Password = serverPass
Table.ApplyLogOnInfo(logonInfo)
Next
Next
report_Batch.SetParameterValue("insertquery", strSelect)
report_Batch.SetParameterValue("customer", strName)
frm_printing.crp_report.ReportSource = report_Batch
frm_printing.crp_report.Zoom(100%)
frm_printing.crp_report.Refresh()
frm_printing.ShowDialog()