ADO DOT NET Posted April 7, 2007 Posted April 7, 2007 Hi, I want to use the Crystal Reports in VS.NET 2005 to print some info from an ACCESS database. I don't 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: 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 won't 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:) Quote
ADO DOT NET Posted April 10, 2007 Author Posted April 10, 2007 How many expert Crystal Report users we have here! :confused: Quote
MrPaul Posted April 10, 2007 Posted April 10, 2007 DatabaseName to ServerName I've 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: Quote Never trouble another for what you can do for yourself.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.