SQL database connection problem

Discussion in 'Databases' started by abt888, Jul 26, 2011.

  1. I created the SQL data base it seems good, but I am having a problem connecting to it.

    I get the error

    Provider error '80040e21'

    Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

    I used the code below, does you anybody have any ideas why I am getting this.



    this is the code in the config.asp file

    'Database connection string (Can be Access or SQL Server).
    'const DATABASE_CONNECTION_STRING = "Data Source=E:\SFpool3\data\NFL.mdb; Provider=Microsoft.Jet.OLEDB.4.0;"
    const DATABASE_CONNECTION_STRING = "Provider=SQLOLEDB;Data Source=tcp:Winhost.com;Initial Catalog=DB_26_nfl;User ID=DB_26 _nfl_user;Password=xxxxxxx;Integrated Security=False;"

    'Delimiter for datetime literals in SQL statements (Use "#" for Access, "'" for SQL Server).
    'const DATABASE_DATETIME_DELIMITER = "#"
    const DATABASE_DATETIME_DELIMITER = "'"



    this is the code in the common.asp

    ' Opens the database connection (global variable 'DbConn').
    '--------------------------------------------------------------------------
    sub OpenD4b()

    dim isPhysicalPath
    dim dbDir

    set DbConn = Server.CreateObject("ADODB.Connection" )

    DbConn.Open DATABASE_CONNECTION_STRING


    'If the path to the database is not physical, map it.
    isPhysicalPath = false
    if Len(DATABASE_FILE_PATH) >= 3 then
    if Mid(DATABASE_FILE_PATH, 2, 2) = ":\" then
    isPhysicalPath = true
    end if
    end if
    if not isPhysicalPath then
    dbDir = Server.MapPath(DATABASE_FILE_PATH)
    else
    dbDir = DATABASE_FILE_PATH
    end if

    if USE_ACCESS_ODBC_DRIVER then
    DbConn.Open "DBQ="& dbDir & ";Driver={Microsoft Access Driver (*.mdb)}"
    else
    DbConn.Open "Data Source=" & dbDir & ";Provider=Microsoft.Jet.OLEDB.4.0;"
    end if

    end sub




    Thanks,

    Anton
     
    Last edited by a moderator: Oct 14, 2015

Share This Page