Microsoft Access database

Discussion in 'Databases' started by RichardKorts, Jun 10, 2015.

  1. I am moving a website to Winhost that uses an Access database.

    The connection string on the "old" host is like this:
    _____________________________________________

    ' the order of the ? in the query will be the order for the parameter append sequence also:
    qry = "SELECT user, superuser from admins where [user] = ? and [password] = ? "

    ' set the connection name
    mdbfile = "access_db/mod.mdb"
    connstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(mdbfile ) & "; Password= 'abcXYZ';"
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open connstr
    Set Cmd = Server.CreateObject("ADODB.Command")
    Set Cmd.ActiveConnection = Conn

    Cmd.CommandText = qry
    ' the order here is important, it must be the same as in the query (the order of the ? ):
    cmd.Parameters.Append cmd.CreateParameter("@uid", adVarChar, adParamInput, 100, username)
    cmd.Parameters.Append cmd.CreateParameter("@pwd", adVarChar, adParamInput, 100, pwd)

    set rss = Cmd.Execute
    ______________________________________________

    Where the "real" password is something else and the database is in the folder access_db and called mod.mdb.

    Will this work on your server?

    If not, how will it need to be changed?
     
    Last edited by a moderator: Oct 14, 2015
  2. FredC

    FredC Winhost Staff

    this should work just fine as long as you put the database file in the same location.
     
    Michael likes this.

Share This Page