Crystal report

ADO DOT NET

Well-known member
Joined
Dec 20, 2006
Messages
156
Hi,
I want to use the Crystal Reports in VS.NET 2005 to print some info from an ACCESS database.
I dont want to add my database through server explorer since my .mdb file will have a different location at runtime.
To load it into the crystal reports at runtime thru code I need help because I am new to this.
Here is wahat I do:
I added a CrystalReportViewer to my print form and put this code in CrystalReportViewer_Load:
Code:
            CrystalReportViewer.SelectionFormula = "{Users.UserID}=" + GlobalUserID.ToString + ""
            CrystalReportViewer.LogOnInfo(0).ConnectionInfo.DatabaseName = My.Application.Info.DirectoryPath + "\AccessDB.mdb"
            CrystalReportViewer.LogOnInfo(0).ConnectionInfo.UserID = "Admin"
            CrystalReportViewer.LogOnInfo(0).ConnectionInfo.Password = "password"
So it wont work, is there any help, sample or something I can learn how it works?
I was not able to use and understand my MSDN.
Need your help, thank you:)
 
DatabaseName to ServerName

Ive never used Crystal Reports but as far as I know an MDB file is considered a data source, not a database name. Try setting the ConnectionInfo.ServerName property to point to your MDB file instead.

Good luck :cool:
 
Back
Top