FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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
Related topics
Microsoft Visual Basic help
C#,Visual Basic.NET,Visual Studio.NET Videos
visual basic.net
MS Visual Basic Studio 2005 Express Edition
Visual Basic Tutorial - File I/O in VB: Text Files
Visual Basic Tutorial - Control Arrays: What, Why and How
Visual Basic Tutorial - Looping
Visual Basic Express Addition
Visual Basic programming tutorial
graphic programming in visual basic
how to use winsock in visual basic????????
how to create a simple chat using winsock in visual basic???
GD and Visual Basic... Is it possible?
all about visual basic and microsoft access!!!
Reply to topic    Frihost Forum Index -> Scripting -> Others

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