Forums
This topic is locked
SQL ASP Statment Help
Posted 29 Oct 2004 01:58:24
1
has voted
29 Oct 2004 01:58:24 Robert Barker posted:
I keep getting a syntax error, here is my page, it posts back to itself. Thanks ahead to anyone that can help.<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/admin.asp" -->
<!--#include file="../../Connections/page.asp" -->
<%
Dim MM_recordId
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update"



id=CStr(Request("MM_recordId"

template=CInt(Request.Form("template"

title = Request.Form("title"

news = CInt(Request.Form("news"

password = CInt(Request.Form("password"

meetings = CInt(Request.Form("meetings"

subscribe = CInt(Request.Form("subscribe"

modifyby = CStr(Request.Form("user"

descriptionfield = Request.Form("descriptionfield"

testimonials = CInt(Request.Form("testimonials"

keywords = Request.Form("keywords"

If template=1 Then
templatetop="/template/incTOP_home.asp"
ElseIf template=2 Then
templatetop="/template/incTOP_content1.asp"
ElseIf template=3 Then
templatetop="/template/incTOP_content2.asp"
End if
If template=1 Then
templatebottom="/template/incBOTTOM_home.asp"
ElseIf template=2 Then
templatebottom="/template/incBOTTOM_content1.asp"
ElseIf template=3 Then
templatebottom="/template/incBOTTOM_content2.asp"
End if
Dim myConnString
Dim myConnection
Dim mySQL
Set myConnection = Server.CreateObject("ADODB.Connection"

myConnection.Open MM_page_STRING
mySQL = "UPDATE PAGEMAIN SET ( pagemainTITLE, pagemainDESCR, pagemainKEYWORDS, pagemainINCNEWS, pagemainTESTIMONIALS, pagemainINCSUBSCRIBE, pagemainINCMEETINGS, pagemainINCUSERCODE, pagemainTEMPLATE, pagemainTEMPLATETOP, pagemainTEMPLATEBOTTOM, pagemainMODIFYBY ) VALUES ('" & title & "','" & descriptionfield & "','" & keywords & "'," & news & "," & testimonials & "," & subscribe & "," & meetings & "," & password & "," & template & ",'" & templatetop & "','" & templatebottom & "','" & modifyby & "') WHERE pagemainID = " & id& ""
Response.Write "DEBUG: " & mySQL & "<HR><br>"
myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing
End If
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="Browse,Admin"
MM_authFailedURL="../error.asp?type=access"
MM_grantAccess=false
If Session("MM_Username"

If (false Or CStr(Session("MM_UserAuthorization"


(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"

MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?"

MM_referrer = Request.ServerVariables("URL"

if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include virtual="/admin/includes/top.asp" -->
<%
Dim RSPAGE__MMColParam
RSPAGE__MMColParam = "1"
If (Request.QueryString("pageID"


RSPAGE__MMColParam = Request.QueryString("pageID"

End If
%>
<%
Dim RSPAGE
Dim RSPAGE_numRows
Set RSPAGE = Server.CreateObject("ADODB.Recordset"

RSPAGE.ActiveConnection = MM_page_STRING
RSPAGE.Source = "SELECT * FROM PAGEMAIN WHERE pagemainID = " + Replace(RSPAGE__MMColParam, "'", "''"

RSPAGE.CursorType = 0
RSPAGE.CursorLocation = 2
RSPAGE.LockType = 1
RSPAGE.Open()
RSPAGE_numRows = 0
%>
<table width="400" border="0" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="#FFFFFF">
<td class="table"><div align="left" class="textbold"> edit
a
page on the site... </div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="table"><div align="center" class="textGray">
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="43%" class="adminbutton"><div align="right">Page
name:</div></td>
<td width="57%" class="textBold"><%=(RSPAGE.Fields.Item("pagemainURL"

</tr>
<tr>
<td class="adminbutton"><div align="right">Page CreatedBy: </div></td>
<td><span class="textBold"><%=(RSPAGE.Fields.Item("pagemainCREATEBY"

</tr>
<tr>
<td class="adminbutton"><div align="right">Created On: </div></td>
<td class="textBold"><%=(RSPAGE.Fields.Item("pagemainDATECREATE"

</tr>
<tr>
<td class="adminbutton"><div align="right">Page Title:</div></td>
<td><input name="title" type="text" class="adminfield" id="title" value="<%=(RSPAGE.Fields.Item("pagemainTITLE"

</tr>
<tr>
<td valign="top" class="adminbutton"><div align="right">Page Description: </div></td>
<td><input name="descriptionfield" type="text" class="adminfield" id="descriptionfield" value="<%=(RSPAGE.Fields.Item("pagemainDESCR"

</tr>
<tr>
<td class="adminbutton"><div align="right">Search Keywords: </div></td>
<td><input name="keywords" type="text" class="adminfield" id="keywords" value="<%=(RSPAGE.Fields.Item("pagemainKEYWORDS"

</tr>
<tr>
<td class="adminbutton"><div align="right">Include News
Articles?</div></td>
<td><input <%If (CStr((RSPAGE.Fields.Item("pagemainINCNEWS"




</tr>
<tr>
<td class="adminbutton"><div align="right">Include Testimonials? </div></td>
<td><input <%If (CStr((RSPAGE.Fields.Item("pagemainTESTIMONIALS"




</tr>
<tr>
<td class="adminbutton"><div align="right">Include Subscription Form?</div></td>
<td><input <%If (CStr((RSPAGE.Fields.Item("pagemainINCSUBSCRIBE"




</tr>
<tr>
<td class="adminbutton"><div align="right">Include Meetings
Calendar? </div></td>
<td><input <%If (CStr((RSPAGE.Fields.Item("pagemainINCMEETINGS"




</tr>
<tr>
<td class="adminbutton"><div align="right">Make Password Protected? </div></td>
<td><input <%If (CStr((RSPAGE.Fields.Item("pagemainINCUSERCODE"




</tr>
<tr>
<td colspan="2"><div align="center">
<table width="100%" border="0" cellpadding="1" cellspacing="1" class="table">
<tr>
<td colspan="3" class="textGray"><div align="center">Please
choose an appropriate layout for this page. You
may later change the layout for the page at a
future time. </div></td>
</tr>
<tr>
<td width="30%"><div align="center"><img src="/admin/images/homepage_layout.gif" width="50" height="50"></div></td>
<td width="33%"><div align="center"><img src="/admin/images/content1_layout.gif" width="50" height="50"></div></td>
<td width="37%"><div align="center"><img src="/admin/images/content2_layout.gif" width="50" height="50"></div></td>
</tr>
<tr>
<td><div align="center">
<input <%If (CStr((RSPAGE.Fields.Item("pagemainTEMPLATE"




</div></td>
<td width="33%"><div align="center">
<input <%If (CStr((RSPAGE.Fields.Item("pagemainTEMPLATE"




</div></td>
<td width="37%"><div align="center">
<input <%If (CStr((RSPAGE.Fields.Item("pagemainTEMPLATE"




</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><div align="right">
<input name="Submit2" type="reset" class="adminbutton" value="Clear Form">
</div></td>
<td><input name="Submit" type="submit" class="adminbutton" value="Update Page">
<input name="user" type="hidden" id="user2" value="<%=Session("MM_Username"

<input name="templatetop" type="hidden" id="templatetop" value="<%=(RSPAGE.Fields.Item("pagemainTEMPLATETOP"

<input name="templatebottom" type="hidden" id="templatebottom" value="<%=(RSPAGE.Fields.Item("pagemainTEMPLATEBOTTOM"

<input name="page" type="hidden" id="page" value="<%=(RSPAGE.Fields.Item("pagemainURL"

</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= RSPAGE.Fields.Item("pagemainID"

</form>
</div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="table"> </td>
</tr>
</table>
<!--#include virtual="/admin/includes/bottom.asp" -->
<%
RSPAGE.Close()
Set RSPAGE = Nothing
%>
Replies
Replied 29 Oct 2004 02:05:50
29 Oct 2004 02:05:50 Robert Barker replied:
Ignore all of this I am an idiot, got it working, I was hand blending a nice 1 part Insert, with 1 part Update to make a nice SQL Daquari!!!!