FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

ms access and visual basic

 


kawkazEE
how do i connect to a password protected ms access database using visual basic ado (not the visual component). ive heard it has something to do with the connection string ... please help..
gaudi
Option Explicit
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
----------------
Dim database$
database= App.Path + "\adresses.mdb"
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient 'set cursor
'conn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & database& ";Persist Security Info=False;"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database& ";Persist Security Info=False;"
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = conn
rs.Open "select * from adresses order by name", , adOpenKeyset, adLockOptimistic, adCmdText
kawkazEE
where did the username and password for the database go?
blueray
hi, append this to the end of the connection string
Quote:

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database& ";Persist Security Info=False;User id=[you-username-here];Password=[you-password-go-here];"


Hope this help
kawkazEE
tnx blueray but i got a follow-up question, how do i set the username and password in ms access.. hehehe Twisted Evil Twisted Evil
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.