Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Needs Help With ASP Code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Needs Help With ASP Code

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: Needs Help With ASP Code
    Posted: 29 June 2005 at 2:09am
I have noticed that some sql strings work differently in Access and SQL Server 2000. I am using SQL Server 2000 for this particular page.

I am getting the following error message: Line 1: Incorrect syntax near '='.

/EditStaffInfo.asp, line 27
 
It is likely that I have a typo somewhere. The form will show the data. I get the above error message after I press the button. I have bolded the significant parts of my code.
 
Here's my code:
 

'----------------------------------------------------------

' name: CreateOneRecordRecordset(soughtKeyValue)

'----------------------------------------------------------

Sub CreateOneRecordRecordset(soughtKeyValue)

 

    

      'Build the sql query used to fill the select element

      sqlString = "select * from MMBCStaff where StaffID=" & soughtKeyValue

 

         

      'Create a recordset

      set rs = Server.CreateObject("ADODB.Recordset")

      rs.Open sqlString, connectionString, adOpenDynamic, adLockOptimistic

 

  End Sub   

 

'----------------------------------------------------------

' name: EditOneRecordRecordset(soughtKeyValue)

'----------------------------------------------------------

Sub EditOneRecordRecordset(soughtKeyValue)

 

    dim Edited

    

    'Get values for new record

    rs("Name") = Request.Form("txtName")

    rs("Title") = Request.Form("txtPosition")

    rs("Email") = Request.Form("txtEmail")

    rs("Bio") = Request.Form("txtaBio")

 

     

                & ;nbs p;

            rs.Update

 

            Edited = "True"

 

  End Sub

     

    '----------------------------------------------------------

    ' name: DrawPage

    '------------------------------------------------------

Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 2:34am
where is line #27?
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 12:46pm
Line 27 is rs.Open sqlString, connectionString, adOpenDynamic, adLockOptimistic.
 
The problem is really with the sql string. Can someone please help me with this?
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 9:35pm
does soughtKeyValue actually have a value in it?

Do
response.write(
sqlString)
response.end

to see the actual sql that is being passed to the query.

Alos try as the sql string


SELECT
MMBCStaff.*, MMBCStaff.StaffID FROM MMBCStaff WHERE (((MMBCStaff.StaffID)=" & soughtKeyValue & "));



Edited by Phat - 29 June 2005 at 9:36pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.