p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Weird Error with Recordset.Update Method


Message #1 by "Brett Goodwin" <anomalation@d...> on Fri, 7 Jul 2000 20:14:30
I get the following error:



Microsoft OLE DB Provider for ODBC Drivers error '80004005' 



[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the 

keyword 'To'.



/administrative/NewPostAction.asp, line 23 



This occurs when I execute the following code:



<%Option Explicit%>

<!-- metadata type="typelib" file="C:\Program Files\Common 

Files\System\ado\msado15.dll" -->

<!-- #include file="HasPermission.asp" -->

<%

	If Not HasPermission("NewPosts", Session("Area")) Then

		Response.Write "<html><head><title>Error</title></head><body 

bgcolor='#FFFFFF' text='#000000' link='#0000FF' vlink='#4FADFF' 

alink='#0000FF'><center><img src='..\ctin\images\Msg.gif'>"&_

		"<br><font size='3' face='Verdana,Helvetica'><strong>Either you have 

attempted to access this page without logging in,  your session has 

expired, or you do not have permission to access this area of the site."&_

		"<br>If you have questions, or the problem persists, please contact <a 

href='mailto:support@b...'>BRTRC Support</a> with a full description 

of the circumstances leading up to the 

error.</strong></font></center></body></html>"

		Response.End

	End If



	Dim objRS, tblName

	Set objRS=Server.CreateObject("ADODB.Recordset")

	objRS.Open "SELECT * FROM NewPostings WHERE Recnum='" & 

CStr(Request.Form("Recnum")) & "'", Application("CTIN_ConnectionString"), 

adOpenForwardOnly, adLockOptimistic, adCmdText

	

	If Not HasPermission(objRS("Area"), Session("Area")) Then

		Response.Write "You do not have permission to perform this action."

		Response.End

	End If

	

	If Request.Form("Reject")="Reject" Then

		objRS("Posting_Status")="Rejected"

		objRS.Update

		objRS.Close

		Response.Write "Rejection successful"

		Response.End



I know that the connection string works (works on other pages), the field 

names and everything are typed correctly.  A note:  this worked on my test 

server, it only gave me the error when I brought it to the live server.  

Can anyone help me with this?  Thanks.

Message #2 by "Ken Schaefer" <ken.s@a...> on Mon, 10 Jul 2000 14:45:08 +1000
Which is line 23?

What is in the HasPermissions.asp include file (which I assume contains the

function you are calling)?



Cheers

Ken



----- Original Message -----

From: "Brett Goodwin" <>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, July 07, 2000 8:14 PM

Subject: [asp_databases] Weird Error with Recordset.Update Method





> I get the following error:

>

> Microsoft OLE DB Provider for ODBC Drivers error '80004005'

>

> [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the

> keyword 'To'.

>

> /administrative/NewPostAction.asp, line 23

>

> This occurs when I execute the following code:

>

> <%Option Explicit%>

> <!-- metadata type="typelib" file="C:\Program Files\Common

> Files\System\ado\msado15.dll" -->

> <!-- #include file="HasPermission.asp" -->

> <%

> If Not HasPermission("NewPosts", Session("Area")) Then

> Response.Write "<html><head><title>Error</title></head><body

> bgcolor='#FFFFFF' text='#000000' link='#0000FF' vlink='#4FADFF'

> alink='#0000FF'><center><img src='..\ctin\images\Msg.gif'>"&_

> "<br><font size='3' face='Verdana,Helvetica'><strong>Either you have

> attempted to access this page without logging in,  your session has

> expired, or you do not have permission to access this area of the site."&_

> "<br>If you have questions, or the problem persists, please contact <a

> href='mailto:support@b...'>BRTRC Support</a> with a full description

> of the circumstances leading up to the

> error.</strong></font></center></body></html>"

> Response.End

> End If

>

> Dim objRS, tblName

> Set objRS=Server.CreateObject("ADODB.Recordset")

> objRS.Open "SELECT * FROM NewPostings WHERE Recnum='" &

> CStr(Request.Form("Recnum")) & "'", Application("CTIN_ConnectionString"),

> adOpenForwardOnly, adLockOptimistic, adCmdText

>

> If Not HasPermission(objRS("Area"), Session("Area")) Then

> Response.Write "You do not have permission to perform this action."

> Response.End

> End If

>

> If Request.Form("Reject")="Reject" Then

> objRS("Posting_Status")="Rejected"

> objRS.Update

> objRS.Close

> Response.Write "Rejection successful"

> Response.End

>

> I know that the connection string works (works on other pages), the field

> names and everything are typed correctly.  A note:  this worked on my test

> server, it only gave me the error when I brought it to the live server.

> Can anyone help me with this?  Thanks.






  Return to Index