We want to batch printing for sales order
My code:
For i As Integer = 0 To dt.Rows.Count - 1
Dim ID As String = dt.GetValue("ID", i)
Dim rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rd.Load(rptName)
rd.SetDatabaseLogon(uid, pwd, Server, CompanyDB)
rd.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True
rd.SetParameterValue("@ID", ID)
rd.ReportClientDocument.PrintOutputController.PrintReport()
Next
but after printing the first order, I got error in the line:
rd.ReportClientDocument.PrintOutputController.PrintReport()
Error Message:
Logon failed.
Details: [Database Vendor Code: 18456 ]
Error in File report{1E1B4615-936D-4CDE-86AC-C167CE758238}.rpt:
Unable to connect: incorrect log on parameters.
Details: [Database Vendor Code: 18456 ]
I have tried for many times, but still got the same error, do have any sample code like this?
Regards,
David