hi friends,

i m very newbie to vb.net.
i'm using opendialog control to select the database file. this works for me.

Private Sub btnbrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbrowse.Click
        txtfilename.Text = opendatabase.FileName
    End Sub

Then i need to connect with the actual code.
i'm able to connect my database only by giving the direct path in the code.

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = G:\module1\module1\student.mdb"

but i need some other way to access database path from the textbox( i.e., in my code it is txtfilename.text).

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = txtfilename.text"

i need your help friends..

-- Thanks in advance...

--With Regards--

Re: database path set in vb.net 80 80

Is the location of your database going to change?
If not, I suggest using a different technique like registering your DB as an ODBC DataSource and connecting to it using a DataSource Name DSN. That way, the specific driver is already set for the given DB and you don't need to choose it every time.

Here is a BING SEARCH for many ways to connect to an access database.

Re: database path set in vb.net 80 80

Not only the location are going to change. I'm using different database.

Re: database path set in vb.net 80 80

try this

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"        
dbSource = "Data Source = " & txtfilename.text
commented: Thanks a lot.. Its working.. Contact you later for further doubt.. Thanks a lot.. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.