Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb2010 and access database error in program files

Status
Not open for further replies.

jkoroso

Programmer
Nov 1, 2011
2
ES
Hi!

I finished my application whith vb2010, this application uses a Access database. I have a problem because when I install my application he put database in de same path “program files” and this path is only read And my application crahed. I know how to installer put database in other path but I don’t know how to tell my application to find this database.

thanks
 
Install to the new path

At runtime change your connectionstring property to point to the new path

Example:

Code:
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Database.accdb"
    End Sub

 
Thaks Keyth!!


it´s great solution, i added my conection string drag and drop, not by code. i will change the paht :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top