Im going to create a project with vb6 and ms access. I have to set password
to open the DB for security. In vb6, how can i connect the database in data environment through data link properties setting the provider,database and the database password?? If I can do this, are there any possible problems that will occur when I create and call commands in data environment?? Please help me. I urgently need this. Thank you..

Set CN1 = New ADODB.Connection
CN1.CursorLocation = adUseClient

---------------------------------------------------------------------------------------
' This is a connect string for Access
CN1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source="c:\data\icd02.mdb"


'password entry
CN1.Properties("jet OLEDB:Database Password") = "charlyX"

Thanks for the help.

Try this sample connection string.

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\mydb.mdb;" & _ 
           "Jet OLEDB:Database Password=MyDbPassword", _
           "myUsername", "myPassword"
Be a part of the DaniWeb community

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