[RESOLVED] Data Source Connection (MS Access, crystal Reports)
Hi All,
I have created a data source connection to an access db by using the wizard in vs2008. I have then used this as a data source for crystal reports. My user would like to put the database on a network and reference it there. Is there a way to set a new path for this data source during runtime?
Re: Data Source Connection (MS Access, crystal Reports)
You can use an OpenFileDialog to get the location of the database and then use the .filename property to get the file location for your connection string.
Code:
' This is a basic example
Dim con As New OleDb.OleDbConnection
m_dbfile = OpenFileDialog1.FileName
con.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & m_dbfile & ""
Re: Data Source Connection (MS Access, crystal Reports)
Tank you for your response.
This portion I know.
What I would like to know is if I have an existing data source created through the vs 2008 wizard, how to I reference and change the connection to this data source.
Re: Data Source Connection (MS Access, crystal Reports)
I guess I'm not sure what you're asking. You want to change the location of the data source after you've already connected to it?
Re: Data Source Connection (MS Access, crystal Reports)
Thanks for help, but I found what I managed to solve my problem by following another route.
Answer