change crystal report access oledb location at runtime

I want to run a crystal report in my vs2005 web application. It uses two Access databases that are related in the report. The problem is that I used oledb and at design time I had to set the databse location of one of them to the application's app_data folder that is under MyDocuments\microsoft visual studio2005\projects\yada yada yada since that is where it is when I am developing the app. But when it moves to the actual web server that will no longer be the proper path. How do I deal with this? The other database path is OK since it is the same path on both the development machine and the production one. How do I change the location either at run time with code or by setting the thing up at design time?

I have seen some sql server and oracle examples on Google using report.DataSourceConnections(0).SetConnection but it asks for a server name as well as a database name and I have no idea what the server name for an access database is. Also, what is the database name as opposed to the server name? Which one requires the full path in addition to the file name so it can find it? Is this even the thing to use?

This should be a lot eaiser.

You would think this would be a basic issue well-covered by the documentation since VS2005 runs its web sites on its virtual server using the project's file location which is never going to be the same as an actual web server.

So how do I do this, and remember I only need to change the location of one of the databases in the report.

tomkovicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
I believe the method is covered in this document
http://www.businessobjects.com/global/pdf/dev_zone/VS2005_Walkthroughs.pdf

mlmcc
0
tomkovicAuthor Commented:
I'm sorry, I'm sure you mean to be helpfull otherwise you would not have posted but saying a 591 page document covers my question doesn't really narrow things down much. I read through the table of contents and I could not see anything that covered ACCESS databases and what I did see had nothing to do with setting and changing the location. I allready have the VS2005 documentation, the crystal reports documentatin and the internet. I need some specific help here.
0
adriankohwsCommented:
Give you a basic example here: Basically the Servername here refers to the location of your Access Database File. For web application, you can use Server.MapPath(Foldername)

  'Set the connection information to ConInfo object so that we can apply the
            ' connection information on each table in the reporteport
            ConInfo.ConnectionInfo.UserID = YourDBUserid
            ConInfo.ConnectionInfo.Password = YourDBPwd
            ConInfo.ConnectionInfo.ServerName = YourDBLocation
            ConInfo.ConnectionInfo.DatabaseName = YourDBName

            eReport.FileName = Path
            rptViewer.ParameterFieldInfo = eParameters
            eReport.DataSourceConnections.Item(0).SetConnection(eReportLink, DBName, DBUserid, DBPwd)
...
...
...


Hope it helps.
0
tomkovicAuthor Commented:
is YourDBLocation the full path including the database file itself or the full path to the folder containing the file?

The db has no user name or password. Do I put empty strings in there?
0
adriankohwsCommented:
If I don't remember wrongly, Access connection for Servername should be including the database filename.

The default username for Access is "Admin",  give a empty string as "" for password if you don't have.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.