Hi, I'm a newbie in VB.Net, need some help here. I'm generating a report and view it in a win app, which is in VB.Net. I've specified the database logon info by the following code:
*************************************************
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
Dim crReportDocument As New cr1()
With crConnectionInfo
.ServerName = "mydb"
.UserID = "myuserid"
.Password = "mypassword"
End With
CrTables = crReportDocument.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
CrystalReportViewer1.ReportSource = crReportDocument
End Sub
*****************************************************
It's an Oracle DB and just one table, suppose to be very simple. But whenever the app starts, this "Database Login" window always opens first, asking for server info, db info, user name and password. Actually if I click "Cancel", the report still get generated. So how to get rid of this annoying "Database Login" window?
My second question is, how to automatically send this report to printer? I know in VB6 you just say action=1. Unfortunately this thing doesn't work in .Net any more.
Thanks!Just look through CrystalReport knowledgebase, seems that this is a known issue. Refer to this article:
http://support.businessobjects.com/library/kbase/articles/c2010461.asp
Is there already a fix for this ?|||Figured this out by carefully reading this article: http://support.businessobjects.com/library/kbase/articles/c2010461.asp
The Form_new method has to be overwritten, adding some customized initialization, where ser/uid/pass can be specified.
**** I just took it for granted to do it in Form_load...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment