jonthomas83
04-14-2007, 04:51 AM
Hi guys I've done everything apart from the final hurdle with a forum that I've been working on.
I keep getting the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/02014092/lightsynth/forum_add_reply.asp, line 115
I'm trying to post a reply to a thread that is stored in one table and the reply will be stored in a new table.
I'm using the insert new record function with ASP but nothing seems to work.
Here's the code!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/MyRepliesConnection.asp" -->
<%
' *** Edit Operations: declare variables
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")) = "form2") Then
MM_editConnection = MM_MyRepliesConnection_STRING
MM_editTable = "reply"
MM_editRedirectUrl = "forum_replied_successfully.asp"
MM_fieldsStr = "MyTopicReply|value|MyUsernameReply|value|MyPostReply|value"
MM_columnsStr = "MyTopicReply|',none,''|MyUsernameReply|',none,''|MyPostReply|',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
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="nav.js"></script>
<body>
<%
Response.Expires = -1000 'Makes the browser not cache this page
Response.Buffer = True 'Buffers the content so our Response.Redirect will work
If Session("UserLoggedIn") <> "true" Then
Response.Redirect("login.asp")
End If
%>
<div class="main">
<img src="images/logo.png" alt="Lightsynth" width="619" height="86" />
<div id="globalNav">
<div id="globalLink"><a href="index.html" id="gl1" class="glink" onMouseOver="ehandler(event,menuitem1);">Home</a><a href="http://lightsynth.blogspot.com/" id="gl2" class="glink" onMouseOver="ehandler(event,menuitem2);" target="_blank">Blog</a><a href="history.html" id="gl3" class="glink" onMouseOver="ehandler(event,menuitem3);">History</a><a href="products.html" id="gl4" class="glink" onMouseOver="ehandler(event,menuitem4);">Products</a><a href="downloads.html" id="gl5" class="glink" onMouseOver="ehandler(event,menuitem5);">Downloads</a><a href="contact_us.html" id="gl6" class="glink" onMouseOver="ehandler(event,menuitem6);">Contact Us</a><a href="members_home.asp" id="gl7" class="glink" onMouseOver="ehandler(event,menuitem7);">Members</a><a href="links.html" id="gl8" class="glink" onMouseOver="ehandler(event,menuitem8);">Links</a></div>
<!-- end globalNav -->
<div id="subglobal1" class="subglobalNav"> </div>
<div id="subglobal2" class="subglobalNav"> </div>
<div id="subglobal3" class="subglobalNav"> <a href="making_of.html">Making The Lightsynth</a> | <a href="video_diary.html">Video Diary</a></div>
<div id="subglobal4" class="subglobalNav"> <a href="products.html">About Our Products</a> | <a href="audio.html">Audio Demo's</a> | <a href="video.html">Video Demo's</a></div>
<div id="subglobal5" class="subglobalNav"> <a href="vst.html">VST Upgrades</a> | <a href="firmware.html">Firmware Upgrades</a> | <a href="manuals.html">Manuals</a> | <a href="members_tunes.asp">Members Tunes</a>
</div>
<div id="subglobal6" class="subglobalNav"></div>
<div id="subglobal7" class="subglobalNav"><a href="view_all_members.asp">View All Members</a> | <a href="update_account.asp">Update Personal Account</a> | <a href="forum.asp">Members Forum</a></div>
<div id="subglobal8" class="subglobalNav"></div>
<script type="text/javascript" src="hidden.js"></script>
</div>
<div class="content"><h1><img src="images/members_forum_pic.gif" alt="Members Forum" /></h1>
<div class="login_info"><p>Logged in as: <a href="members_home.asp"><span class="user"><%Response.Write (Request.Cookies("DisplayName")) %></span></a> | <a href="logout.asp">Logout</a></p>
</div>
<p>Add Reply to Topic - </p>
<form method="POST" action="<%=MM_editAction%>" name="form2">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Topic:</td>
<td><input type="hidden" name="MyTopicReply" value="<%=Request.QueryString("MyTopic")%>" size="32"><%=Request.QueryString("MyTopic")%>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Username:</td>
<td><input type="hidden" name="MyUsernameReply" value="<%Response.Write (Request.Cookies("DisplayName")) %>" size="32"><%Response.Write (Request.Cookies("DisplayName")) %>
</td>
</tr>
<tr>
<td nowrap align="right" valign="top">Message:</td>
<td valign="baseline"><textarea name="MyPostReply" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Add Message">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2">
</form>
</div>
</div></body>
</html>
I keep getting the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/02014092/lightsynth/forum_add_reply.asp, line 115
I'm trying to post a reply to a thread that is stored in one table and the reply will be stored in a new table.
I'm using the insert new record function with ASP but nothing seems to work.
Here's the code!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/MyRepliesConnection.asp" -->
<%
' *** Edit Operations: declare variables
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")) = "form2") Then
MM_editConnection = MM_MyRepliesConnection_STRING
MM_editTable = "reply"
MM_editRedirectUrl = "forum_replied_successfully.asp"
MM_fieldsStr = "MyTopicReply|value|MyUsernameReply|value|MyPostReply|value"
MM_columnsStr = "MyTopicReply|',none,''|MyUsernameReply|',none,''|MyPostReply|',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
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="nav.js"></script>
<body>
<%
Response.Expires = -1000 'Makes the browser not cache this page
Response.Buffer = True 'Buffers the content so our Response.Redirect will work
If Session("UserLoggedIn") <> "true" Then
Response.Redirect("login.asp")
End If
%>
<div class="main">
<img src="images/logo.png" alt="Lightsynth" width="619" height="86" />
<div id="globalNav">
<div id="globalLink"><a href="index.html" id="gl1" class="glink" onMouseOver="ehandler(event,menuitem1);">Home</a><a href="http://lightsynth.blogspot.com/" id="gl2" class="glink" onMouseOver="ehandler(event,menuitem2);" target="_blank">Blog</a><a href="history.html" id="gl3" class="glink" onMouseOver="ehandler(event,menuitem3);">History</a><a href="products.html" id="gl4" class="glink" onMouseOver="ehandler(event,menuitem4);">Products</a><a href="downloads.html" id="gl5" class="glink" onMouseOver="ehandler(event,menuitem5);">Downloads</a><a href="contact_us.html" id="gl6" class="glink" onMouseOver="ehandler(event,menuitem6);">Contact Us</a><a href="members_home.asp" id="gl7" class="glink" onMouseOver="ehandler(event,menuitem7);">Members</a><a href="links.html" id="gl8" class="glink" onMouseOver="ehandler(event,menuitem8);">Links</a></div>
<!-- end globalNav -->
<div id="subglobal1" class="subglobalNav"> </div>
<div id="subglobal2" class="subglobalNav"> </div>
<div id="subglobal3" class="subglobalNav"> <a href="making_of.html">Making The Lightsynth</a> | <a href="video_diary.html">Video Diary</a></div>
<div id="subglobal4" class="subglobalNav"> <a href="products.html">About Our Products</a> | <a href="audio.html">Audio Demo's</a> | <a href="video.html">Video Demo's</a></div>
<div id="subglobal5" class="subglobalNav"> <a href="vst.html">VST Upgrades</a> | <a href="firmware.html">Firmware Upgrades</a> | <a href="manuals.html">Manuals</a> | <a href="members_tunes.asp">Members Tunes</a>
</div>
<div id="subglobal6" class="subglobalNav"></div>
<div id="subglobal7" class="subglobalNav"><a href="view_all_members.asp">View All Members</a> | <a href="update_account.asp">Update Personal Account</a> | <a href="forum.asp">Members Forum</a></div>
<div id="subglobal8" class="subglobalNav"></div>
<script type="text/javascript" src="hidden.js"></script>
</div>
<div class="content"><h1><img src="images/members_forum_pic.gif" alt="Members Forum" /></h1>
<div class="login_info"><p>Logged in as: <a href="members_home.asp"><span class="user"><%Response.Write (Request.Cookies("DisplayName")) %></span></a> | <a href="logout.asp">Logout</a></p>
</div>
<p>Add Reply to Topic - </p>
<form method="POST" action="<%=MM_editAction%>" name="form2">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Topic:</td>
<td><input type="hidden" name="MyTopicReply" value="<%=Request.QueryString("MyTopic")%>" size="32"><%=Request.QueryString("MyTopic")%>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Username:</td>
<td><input type="hidden" name="MyUsernameReply" value="<%Response.Write (Request.Cookies("DisplayName")) %>" size="32"><%Response.Write (Request.Cookies("DisplayName")) %>
</td>
</tr>
<tr>
<td nowrap align="right" valign="top">Message:</td>
<td valign="baseline"><textarea name="MyPostReply" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Add Message">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2">
</form>
</div>
</div></body>
</html>