32 users online (1 members and 31 guests)  


  Results 1 to 6 of 6

Related

  1. Replies: 0
  2. perl database connection problem    Forum: CGI Perl Forum
    Replies: 0
  3. How to Decode the data from Database using database handler?    Forum: Search Engine Optimization - SEO - Forum
    Replies: 1
  4. database connection error    Forum: Databases
    Replies: 4
  5. Replies: 0
  1. #1
    rocksteady's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    3

    need help with database connection

    hello all

    I'm a making a website and the particular problem I'm having is with the database - website connection. I'm using dreamweaver mx, and have set up(i hope) the connection using steps i've gotten from 2 different books.

    When i test the connection it is made successfully, however, when i try to register a user, the browser gives me this error:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver] Could not use '(unknown)'; file already in use.
    /reguser.asp, line 51

    I've tried doing a new page, making another registration form, making new database, new connections, new DSN connection, but all of these havent worked.

    I would appreciate any help!
    have a good day

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi there, welcome to the forums.

    Could you post the code here?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    rocksteady's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    3
    here's the portion of code that deals with the database connection:

    line 51 I have marked with the smile icon.

    <!--#include file="Connections/conPE.asp" -->
    <%

    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Request.QueryString
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Redirect if username exists
    MM_flag="MM_insert"
    If (CStr(Request(MM_flag)) <> "") Then
    MM_dupKeyRedirect="register.asp"
    MM_rsKeyConnection=MM_conPE_STRING
    MM_dupKeyUsernameValue = CStr(Request.Form("ULogin"))
    MM_dupKeySQL="SELECT UserLogIn FROM Tbl_Users WHERE UserLogIn='" & MM_dupKeyUsernameValue & "'"
    MM_adodbRecordset="ADODB.Recordset"
    set MM_rsKey=Server.CreateObject(MM_adodbRecordset)
    MM_rsKey.ActiveConnection=MM_rsKeyConnection
    MM_rsKey.Source=MM_dupKeySQL
    MM_rsKey.CursorType=0
    MM_rsKey.CursorLocation=2
    MM_rsKey.LockType=3
    MM_rsKey.Open
    If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
    ' the username was found - can not add the requested username
    MM_qsChar = "?"
    If (InStr(1,MM_dupKeyRedirect,"?") >= 1) Then MM_qsChar = "&"
    MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
    Response.Redirect(MM_dupKeyRedirect)
    End If
    MM_rsKey.Close
    End If
    %>
    <%
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "form1") Then

    MM_editConnection = MM_conPE_STRING
    MM_editTable = "Tbl_Users"
    MM_editRedirectUrl = "index.html"
    MM_fieldsStr = "UFName|value|ULName|value|UEmail|value|ULogin|value|UPassword|value"
    MM_columnsStr = "UserFname|',none,''|UserLname|',none,''|UserEmail|',none,''|UserLogIn|',none,''|UserPassword|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it

    Dim MM_tableValues
    Dim MM_dbValues

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
    MM_formVal = MM_emptyVal
    Else
    If (MM_altVal <> "") Then
    MM_formVal = MM_altVal
    ElseIf (MM_delim = "'") Then ' escape quotes
    MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    Else
    MM_formVal = MM_delim + MM_formVal + MM_delim
    End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

    If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Code looks okay. Google for the error and found:

    Source: http://www.webwizguide.info/asp/faq/access_database_faq.asp

    Could not use '(unknown)'; file already in use
    Microsoft OLE DB Provider for ODBC Drivers error '80004005'
    [Microsoft][ODBC Microsoft Access Driver] Could not use '(unknown)'; file already in use.
    This is a bit of an odd error that I have never received myself but have been asked about on number of occasions. It usually means that either incorrect permissions are set on the server or the incorrect version of MDAC (Microsoft Data Access Components installed on the server or the version is not correctly installed). You need to ensure the ODBC version you have is 4 or greater.

    If you are running the web server yourself then read the FAQ, Checking and Setting up the Correct Permissions on the Server and the FAQ on, Checking you have the correct ODBC Access Database Drivers

    If you are not running the server yourself you will need to contact your web space provider and ask them how to sort the problem out.
    Hopefully running through thaat lot will help.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    rocksteady's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    3
    i visited the site you linked, and ..I got it to work.

    Thank you sooo much, I've wasted so much time trying to figure it out. Thanks QuietDean!

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    No worries, glad to have helped.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread