Forum Moderators: open

Message Too Old, No Replies

dreamweaver, asp, and msAccess error message

         

iharper

10:27 pm on May 14, 2005 (gmt 0)

10+ Year Member



I am taking a class in Dreamweaver...
I am down to the last part.
I have an edituser.asp page

this is the page....

<%Option Explicit%>
<!--#include virtual="/IntranetDesignProject/Connections/dsnIKH.asp" -->

<%
'dimension variables
Dim userFirstName, userLastName, userJobTitle, userInternalPhone, userInternalEmail, userPassword, userDept, levelID, rsAddUser, aLevelID, i, strSQL, userID, adoCon, isUser, userHomeAddress, userHomePhone, userHomeEmail

'function to remove single quotes from input
Function stripQuotes(strQuotes)
Dim strOutput
strOutput = Replace(strQuotes, "'","''")
stripQuotes = strOutput
End Function

'which form are we updating user or admin
isUser = false
If Request.Form("formUser") > "" Then
isUser = true
End If

'put the values from our form into variables, using the function stripQuotes to remove quotes
'these are common to both forms
userFirstName = stripQuotes(Request.Form("userFirstName"))
userLastName = stripQuotes(Request.Form("userLastName"))
userJobTitle = stripQuotes(Request.Form("userJobTitle"))
userInternalPhone = stripQuotes(Request.Form("userInternalPhone"))
userInternalEmail = stripQuotes(Request.Form("userInternalEmail"))
userID = Request.Form("userID")

If isUser = true Then
'form fields for user form
userHomeAddress = stripQuotes(Request.Form("userHomeAddress"))
userHomePhone = stripQuotes(Request.Form("userHomePhone"))
userHomeEmail = stripQuotes(Request.Form("userHomeEmail"))
strSQL = "UPDATE tblUsers SET userFirstName = '" & userFirstName & "', userLastName = '" & userLastName & "', userJobTitle = '" & userJobTitle & "', userInternalPhone = '" & userInternalPhone & "', userInternalEmail = '" & userInternalEmail & "', userHomeAddress = '" & userHomeAddress & "', userHomePhone = '" & userHomePhone & "', userHomeEmail = '" & userHomeEmail & "', WHERE userID = '" & userID
Else
levelID = stripQuotes(Request.Form("levelID"))
userDept = stripQuotes(Request.Form("userDept"))
strSQL = "UPDATE tblUsers SET userFirstName = '" & userFirstName & "', userLastName = '" & userLastName & "', userJobTitle = '" & userJobTitle & "', userInternalPhone = '" & userInternalPhone & "', userInternalEmail = '" & userInternalEmail & "', userDept = '" & userDept & "', WHERE userID = '" & userID
End If
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open MM_dsnIKH_STRING
response.write strSQL
'update the record
adoCon.Execute(strSQL)
if isUser = false Then
'delete the levels from the database
strSQL = "DELETE FROM tblUser_levels WHERE userID = " & userID
adoCon.execute(strSQL)
'insert the levels
'split the values sent for levelID into an array using the VBScript Split function
alevelID = Split(levelID, ",")
'loop through that array inserting the levelID and userID
For Each i In alevelID
strSQL = "INSERT INTO tblUser_levels (userID, levelID) VALUES (" & userID & ", " & i & ")"
adoCon.execute(strSQL)
Next
end if
adoCon.Close
Set adoCon = Nothing

Response.Redirect "/IntranetDesignProject/list.asp"
%>

I keep getting this message...

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

/IntranetDesignProject/admin/edituser_script.asp, line 45

line 45 is

adoCon.Execute(strSQL)

all of the script comes directly out of Dreamweaver MX 2004 Design Projects.

My instructor can not find the problem...
In fact he has the same problem on his page

I am very new to this, so it is difficult for me to find problems and fix them...
could someone please, please, please help me with this?

mattglet

3:26 am on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WHERE userID = '" & userID

Take out that single quote.

iharper

4:16 am on May 15, 2005 (gmt 0)

10+ Year Member



I took out the single quote and get the same error message

mattglet

12:26 pm on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you paste your Response.Write strSQL? (be sure to edit the personal details out)

iharper

5:20 pm on May 15, 2005 (gmt 0)

10+ Year Member



UPDATE tblUsers SET userFirstName = '', userLastName = '', userJobTitle = '', userInternalPhone = '', userInternalEmail = '', userDept = '', WHERE userID =
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

/IntranetDesignProject/admin/edituser_script.asp, line 45

bateman_ap

7:08 pm on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you strip out anything from that UPDATE you posted as at the moment there is no user ID in there (infact, no info for any fields)

iharper

7:45 pm on May 15, 2005 (gmt 0)

10+ Year Member



UPDATE tblUsers SET userFirstName = 'Manager', userLastName = 'Manager', userJobTitle = 'Manager', userInternalPhone = '1616', userInternalEmail = 'manager', userDept = '', WHERE userID = 5
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

/IntranetDesignProject/admin/edituser_script.asp, line 45

bateman_ap

10:02 pm on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm, just a thought but try removing the , before WHERE

iharper

5:05 am on May 16, 2005 (gmt 0)

10+ Year Member



not sure what you mean...
there is supposed to be two update statements in the script

one for the user section

one for the admin section

bateman_ap

9:38 am on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



not sure if it makes a difference but I have never seen it but your statement is currently

UPDATE tblUsers SET userFirstName = 'Manager', userLastName = 'Manager', userJobTitle = 'Manager', userInternalPhone = '1616', userInternalEmail = 'manager', userDept = '', WHERE userID = 5

before the WHERE delete the "," so it is

UPDATE tblUsers SET userFirstName = 'Manager', userLastName = 'Manager', userJobTitle = 'Manager', userInternalPhone = '1616', userInternalEmail = 'manager', userDept = '' WHERE userID = 5

iharper

3:36 pm on May 16, 2005 (gmt 0)

10+ Year Member



Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression '' WHERE userID = 8'.

/IntranetDesignProject/admin/edituser_script.asp, line 45

mattglet

3:48 pm on May 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paste your updated UPDATE statement as it stands now.

iharper

5:38 pm on May 16, 2005 (gmt 0)

10+ Year Member



ok.. the update is working for user

so the problem is somewhere in this statement

strSQL = "UPDATE tblUsers SET userFirstName = '" & userFirstName & "', userLastName = '" & userLastName & "', userJobTitle = '" & userJobTitle & "', userInternalPhone = '" & userInternalPhone & "', userInternalEmail = '" & userInternalEmail & "', userDept = '" & userDept & "' WHERE userID = " & userID