#1
  1. No Profile Picture
    eternal novice
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Madrid
    Posts
    455
    Rep Power
    14

    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
    %>
  2. #2
  3. No Profile Picture
    Certified Genius
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    over there
    Posts
    77
    Rep Power
    13

    Unhappy try this maybe


    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

    Comments on this post

    • Gran Roguismo agrees
    • BaronVonDoppleG agrees
    Delenda est Carthago
  4. #3
  5. No Profile Picture
    eternal novice
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Madrid
    Posts
    455
    Rep Power
    14
    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"
  6. #4
  7. No Profile Picture
    Certified Genius
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    over there
    Posts
    77
    Rep Power
    13

    connection string?


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

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

    ...rob
    Delenda est Carthago
  8. #5
  9. No Profile Picture
    Certified Genius
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    over there
    Posts
    77
    Rep Power
    13

    Lightbulb come to think of it


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

IMN logo majestic logo threadwatch logo seochat tools logo