0

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
        opendatabase.ShowDialog()
        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--
Hema..

Edited by Ezzaral: Added code tags. Please use them to format any code that you post. Also, please do not create off-topic polls for no reason.

3
Contributors
3
Replies
6
Views
5 Years
Discussion Span
Last Post by lysezoudn
Featured Replies
  • try this [CODE]dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" dbSource = "Data Source = " & txtfilename.text[/CODE] Read More

0

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

1

try this

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"        
dbSource = "Data Source = " & txtfilename.text
Comments
Thanks a lot.. Its working.. Contact you later for further doubt.. Thanks a lot..
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.