Print Page | Close Window

Needs Help With ASP Code

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=15649
Printed Date: 30 March 2026 at 7:51am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Needs Help With ASP Code
Posted By: Misty
Subject: Needs Help With ASP Code
Date 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

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




Replies:
Posted By: Phat
Date Posted: 29 June 2005 at 2:34am
where is line #27?

-------------
http://buildit.sitesell.com/sitebuildithome.html - Get a website that sells


Posted By: Misty
Date 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?


Posted By: Phat
Date 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 & "));



-------------
http://buildit.sitesell.com/sitebuildithome.html - Get a website that sells



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net