Helpful Information
 
 
Category: ASP Programming
Providing password in asp for access DB

I set passwords in access so they can't be opened seperately, how do I specify the password within the asp code when it accesses the DB? Within the code below:

<%
Dim connect

connect = "catalogo_" & base & ""

%>

<%
Set DataConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
DataConn.Open connect

Set rsDsp = DataConn.Execute("SELECT * FROM modelos WHERE pagina = '" &pagina& "' ORDER BY referencia,modelo,aplicacion,cartucho,ar,sustuido")

If rsDsp.EOF Then
Response.Write "Sorry, no entries in the database!"
Else
%>

i usually do my connection strings like this...

ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(".") & "\data\rob.mdb; User Id=; Password=;"

and then connect the same way you did...this way you don't need a dsn either (which i think is the way you were doing it???)
hope this helps...rob

Thanks but I do need to use dsn. can anyone figure out why the code below gives me an 'Expected end of statement' error?


Set DataConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.RecordSet")
DataConn.Open = "catalogo_holset","admin","turbott"

i think you want it to look a lil more like this...

conn.open "dsn=catalogo_holset; uid=admin; pwd=turbott"

...rob

instead of uid and pwd you might have to say "user id=whatever" and "password=whatever"...it all depends










privacy (GDPR)