Hello everyone, long time no post!
I've been playing around with VB more and more and finding out interesting features for application and I'm getting more enthusiastic every day :D
However, the longer I strive and emerge on the complexity of my applications, the higher the problems are :x
This time I'm having an issue when calling out a printing function that uses crystal reports viewer as its cradle of information, well... sorta lol.
Everytime I wan't to preview a report, I'm asked for login credentials, something that was very odd for me, as I didn't even setup any credentials, when building my code, so I thought that maybe the credentials were the same as the ones I use to login into my DataBase.
NOPE... so I dug around a while for a solution and all points out that I have to override the default secure logon procedure... something that I already have done with the following code:
I followed the following thread and article:
Thread - http://www.crystalreportsbook.com/fo...ts.asp?TID=342
Article - http://devlibrary.businessobjects.co...tingreport.htm
I followed the article to the letter and everytime I try to login with the credentials that I HAVE DEFINED on the code, I still get the error message, which state that the logon failed...
Something odd that I noticed, was that the on the logon form, the "DataBase Name" field was empty while the "Server Name" field had the text: myReceipesDS, which is odd for me, because I explicitly declared the name for the DataBase like this: connectionInfo.DatabaseName = "myReceipesDS", while I didn't declare anything for the Server Name.
I did a recheck on this matter and when I used the Server Name property to declare it's name, it replaced the myReceipesDS with the name I inputed on the Server Name Property, in other words:
connectionInfo.DatabaseName = "myReceipesDS"
connectionInfo.ServerName = "Aqua"
The logon Form:
Server Name: Aqua
DataBase Name: (empty)
I'm losing my mind here... need help
I've been playing around with VB more and more and finding out interesting features for application and I'm getting more enthusiastic every day :D
However, the longer I strive and emerge on the complexity of my applications, the higher the problems are :x
This time I'm having an issue when calling out a printing function that uses crystal reports viewer as its cradle of information, well... sorta lol.
Everytime I wan't to preview a report, I'm asked for login credentials, something that was very odd for me, as I didn't even setup any credentials, when building my code, so I thought that maybe the credentials were the same as the ones I use to login into my DataBase.
NOPE... so I dug around a while for a solution and all points out that I have to override the default secure logon procedure... something that I already have done with the following code:
Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class fCookPrinter
Private rptDoc As ReportDocument
Private Sub fCookPrinter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ConfigureCrystalReports()
End Sub
Private Sub ConfigureCrystalReports()
rptDoc = New CrystalReport1
Dim reportPath As String = Application.StartupPath & "\" & "CrystalReport1.rpt"
rptDoc.Load(reportPath)
Dim connectionInfo As ConnectionInfo = New ConnectionInfo()
connectionInfo.DatabaseName = "myReceipesDS"
connectionInfo.UserID = "test"
connectionInfo.Password = "test123"
SetDBLogonForReport(connectionInfo, rptDoc)
CrystalReportViewer1.ReportSource = rptDoc
End Sub
Private Sub SetDBLogonForReport(ByVal connectionInfo As ConnectionInfo, ByVal reportDocument As ReportDocument)
Dim Tables As Tables = reportDocument.Database.Tables
For Each table1 As CrystalDecisions.CrystalReports.Engine.Table In Tables
Dim TableLogOnInfo As TableLogOnInfo = table1.LogOnInfo
TableLogOnInfo.ConnectionInfo = connectionInfo
table1.ApplyLogOnInfo(TableLogOnInfo)
Next
End Sub
End Class
Thread - http://www.crystalreportsbook.com/fo...ts.asp?TID=342
Article - http://devlibrary.businessobjects.co...tingreport.htm
I followed the article to the letter and everytime I try to login with the credentials that I HAVE DEFINED on the code, I still get the error message, which state that the logon failed...
Something odd that I noticed, was that the on the logon form, the "DataBase Name" field was empty while the "Server Name" field had the text: myReceipesDS, which is odd for me, because I explicitly declared the name for the DataBase like this: connectionInfo.DatabaseName = "myReceipesDS", while I didn't declare anything for the Server Name.
I did a recheck on this matter and when I used the Server Name property to declare it's name, it replaced the myReceipesDS with the name I inputed on the Server Name Property, in other words:
connectionInfo.DatabaseName = "myReceipesDS"
connectionInfo.ServerName = "Aqua"
The logon Form:
Server Name: Aqua
DataBase Name: (empty)
I'm losing my mind here... need help