Help With Databases

newcs_jr

New Member
I was recently looking for some assistance on this issue from my hosting company but they informed me that they can not help me with this problem. I am forwarding my initial question to them on here in hopes that maybe one of you can help me with this very frustrating problem. Any help on this matter would be great. Thanks a lot in advance.



Hello,

I am the web master for doglegdiscs.com and I have a question about databases. I will preface my question with this; I am fairly new at web design, so please bear with me on my questions. My question/issue is this; I have uploaded the entire site to the server but am having problems with the Access Databases contained with in the site. Let me first say that everything works great on my iis server. However, once uploaded to the server, I am unable to write to the database. I can view everything in the database but if I try to update the database, I receive this error:

Microsoft JET Database Engine error '80004005'

Operation must use an updateable query.

/gb/gb_add.asp, line 115

I have investigated this error and have done everything in my power to rectify this, but to no avail. The database directory has the correct permissions set and I also uploaded the databases into the db_access folder on the server. Do I need to upload the entire folder into that directory or just the databases? Could you please give me a step by step on how to set up access databases? I must inform you that I have set up the connections to be dsnless. If you could please help me with these issues I would highly appreciate it. It is driving me crazy trying to figure this one out and not to mention portraying me as an inexperienced web designer. I thank you in advance for any solutions you can give me. Thank you very much for your time
.
 

zkiller

Super Moderator
Staff member
1. make sure proper read/write permissions are set for the folder containing the database as well as the database itself.

2. if the problem prevails after that, please post the corresponding code that is causing the problem. without this, their really isn't much i can do for you.

good luck. :)
 

newcs_jr

New Member
response

Sorry I should have informed you that I have all the correct permissions set on the directories. As I stated before, everything works great on my iis. Anyways, since I know all the permissions are set correctly are is the code for one of my pages containing a database.... Sorry if this is exccesive or not the code you are looking for. Like I said I am fairly new at this.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/con_gb.asp" -->
<%

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

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

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

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

MM_editConnection = MM_con_gb_STRING
MM_editTable = "gb"
MM_editRedirectUrl = "gb_view_login.asp"
MM_fieldsStr = "name|value|mail|value|website|value|comment|value"
MM_columnsStr = "name|',none,''|mail|',none,''|website|',none,''|comment|',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
 

zkiller

Super Moderator
Staff member
i see a typo on this line...

Code:
 MM_columnsStr = "name|',none,''|mail|',none,''|website|',none,''|c omment|',none,''"
also, what's the deal with the | lines and the "none" variables? if you don't with the insert a value in a field, leave it out of your query completely.

i take a closer look at it when i have the time. work owns me.
 
Top