Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2006, 05:48 AM
Authorized User
 
Join Date: Dec 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update record error

Hi I have a problem I've been struggling with for a long time
Pls help me with this

I get the following error :
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'id='.

the error is on this line:
RS.Open "SELECT * FROM aanpassingenPrio WHERE id=" & id

this is the update page:
<%
' Get the Product ID
id = Request( "pid" )

' Open the Database Connection
sConnStats = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../klantDB.mdb")
set conn = Server.CreateObject("ADODB.Connection")

conn.open sConnStats

if request.ServerVariables("REQUEST_METHOD")="POST" then

    sql="update aanpassingenPrio set "& _
        " prioriteit = '" &request.Form("prioriteit") & "' , " & _
        " stat = '"&request.Form("stat")&"'," & _
        " aanpassing = '"&request.Form("aanpassing")&"'," & _
        " commentaar = '"&request.Form("commentaar")&"'" & _
        " opleverdatum = '"&request.Form("opleverdatum")&"'" & _
        " toevoeger = '"&request.Form("toevoeger")&"'" & _
        " where id="&request.form("id")
    conn.execute(sql)
    'response.write sql : response.end
end if

' Open the Recordset
set rs = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection = conn
RS.CursorType = 3
RS.Open "SELECT * FROM aanpassingenPrio WHERE id=" & id
IF NOT RS.EOF THEN
prioriteit = RS( "prioriteit" )
stat = RS( "stat" )
aanpassing = RS( "aanpassing" )
commentaar = RS( "commentaar" )
opleverdatum = RS( "opleverdatum" )
toevoeger = RS( "toevoeger" )
END IF

' Assign Default Values nodig om niet ingevulde velden toch een value te geven
IF commentaar = "" THEN
commentaar = "geen commentaar"
END IF
IF prioriteit = "" THEN
prioriteit = "Null"
END IF
IF stat = "" THEN
stat = "Null"
END IF
IF opleverdatum = "" THEN
opleverdatum = "Null"
END IF

' Close the Recordset
RS.Close

FUNCTION SELECTED( firstVal, secondVal )
IF cSTR( firstVal ) = cSTR( secondVAL ) THEN
     SELECTED = " SELECTED "
END IF
END FUNCTION
%>
<html>

What goes around comes around
__________________
~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
 
Old December 15th, 2006, 09:55 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Your value for the variable ID is empty.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old December 15th, 2006, 10:59 AM
Authorized User
 
Join Date: Dec 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No I've checked that. It isn't empty

Quote:
quote:Originally posted by dparsons
 Your value for the variable ID is empty.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
 
Old December 15th, 2006, 11:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

i maybe see a problem.. check this out..

id = Request( "pid" )
request.form("id")

maybe you are looking for the wrong parameter???
and id is empty.. Doug is right about that...


HTH

Gonzalo
 
Old December 15th, 2006, 11:53 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Given the code you have provided that seems to be the only logical explination. Humor me. Do this:

Response.Write("SELECT * FROM aanpassingenPrio WHERE id=" & id)

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old December 20th, 2006, 10:15 AM
Authorized User
 
Join Date: Dec 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have solved this one! Thank you :)

~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update one record jemacc SQL Server 2000 0 September 12th, 2007 11:47 AM
not update all record mohiddin52 Access VBA 10 May 9th, 2007 11:41 AM
cannot update record keyvanjan ASP.NET 1.0 and 1.1 Basics 0 September 9th, 2006 05:25 AM
error trying to update record in asp method Classic ASP Databases 1 May 9th, 2005 05:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.