DSN-less Connections, Passwords, and Access Databa

Results 1 to 2 of 2

Thread: DSN-less Connections, Passwords, and Access Databa

  1. #1
    Steve Gomez Guest

    Default DSN-less Connections, Passwords, and Access Databa

    I&#039ve been trying to create a DSN-less connection to an passworded access database. Any way I try to pass the password I get errors like "You do not have permission to view the data" or "The database is exclusively locked". All of the examples I have seen do not show how to pass this information. <BR><BR>Here is an example of what I am doing:<BR><BR>Dim adoConn<BR><BR>Set adoConn = Server.CreateObject("ADODB.Connection")<BR>adoConn .Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR> "DBQ=C:mypathmydatabase.mdb; UID=admin; PWD=wishyouknew;"<BR><BR>I have tried many variations of this, but nothing seems to work. Anyone have any ideas?<BR><BR>Thanks in advance...<BR><BR>-Steve<BR><BR>P.S. I know I can connect to the db in many other ways, but my boss wants it DSN-less.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: DSN-less Connections, Passwords, and Access Da

    Personally, this is how I do a DSN-less connection.<BR><BR>In my global.asa file, I set an Application Variable...<BR><BR>P.S. I use OLEDB, especially for Access, as it is slow enough as it is. Don&#039t forget, the database must be on the web server in the directory supplied. You may also need to give the IUSR_computername READ/WRITE privelages to said directory.<BR><BR>Application("connection_string") = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:mypathmydatabase.mdb; UID=admin; PWD=wishyouknew;"<BR><BR>Then, on an ASP page where I am ready to return records...<BR><BR>Set rst = CreateObject("ADODB.Recordset")<BR><BR>strSQL = "SELECT fieldname(s) FROM tablename(s) WHERE..."<BR><BR>rst.Open strSQL, Application("connection_string"), cursortype, locktype<BR><BR>Then do your processing (displaying to a table)...<BR>&#060;TABLE&#062;...&#060;/TABLE&#062;<BR><BR>And Clean up after "your messy self"<BR><BR>rst.Close<BR>Set rst = Nothing<BR><BR>HTH<BR><BR>Jerry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts