Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:)

Posted

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:

Never trouble another for what you can do for yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...