Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Something is wrong with this SQL


Message #1 by "Jonathan Gravois" <wynnewade@t...> on Mon, 1 Oct 2001 23:52:23 -0500
Code below produces this error "Microsoft JET Database Engine error

'80040e14' Syntax error (missing operator) in query Expression

'Email=jon@t...'. /Tour/UpdateTourQuiz.asp, line 68" I am at wit's

end. Please help!



Jon



By the way, Line 68 is the first "Conn.Execute(SQL)"



<%

Dim Conn, dbPath

  dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

  Set Conn = Server.CreateObject("ADODB.Connection")

  Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



if (Session("TourQuiz") = "Passed") then

	Dim SQL

	SQL = "UPDATE tblStudentData SET TourQuiz=Passed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

else

	SQL = "UPDATE tblStudentData SET TourQuiz=Failed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

end if

%>



Message #2 by "Michael Kent Simmons" <msimmons@u...> on Tue, 2 Oct 2001 07:42:15 -0300
jg:



use double quotes outside your sql string, single quotes inside. hth



m.





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

From: "Jonathan Gravois" <wynnewade@t...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, October 02, 2001 1:52 AM

Subject: [access_asp] Something is wrong with this SQL





> Code below produces this error "Microsoft JET Database Engine error

> '80040e14' Syntax error (missing operator) in query Expression

> 'Email=jon@t...'. /Tour/UpdateTourQuiz.asp, line 68" I am at wit's

> end. Please help!

>

> Jon

>

> By the way, Line 68 is the first "Conn.Execute(SQL)"

>

> <%

> Dim Conn, dbPath

>   dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

>   Set Conn = Server.CreateObject("ADODB.Connection")

>   Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath

>

> if (Session("TourQuiz") = "Passed") then

> Dim SQL

> SQL = "UPDATE tblStudentData SET TourQuiz=Passed WHERE Email=" &

> Session("Email")

> Conn.Execute(SQL)

> Conn.Close

> Response.Redirect "../MemberHome.asp"

> else

> SQL = "UPDATE tblStudentData SET TourQuiz=Failed WHERE Email=" &

> Session("Email")

> Conn.Execute(SQL)

> Conn.Close

> Response.Redirect "../MemberHome.asp"

> end if

> %>
Message #3 by "Frank Kech" <fkech@s...> on Tue, 2 Oct 2001 07:33:03 -0500
Jonathan, I see two problems. 1) you are only Dimensioning SQL if "TourQuiz"

passed. Should move up the Dim higher in the logic chain. 2) I don't see the

ending " mark and ; at the end of the SQL statement.   -Frank







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

From: Jonathan Gravois [mailto:wynnewade@t...]

Sent: Monday, October 01, 2001 11:52 PM

To: Access ASP

Subject: [access_asp] Something is wrong with this SQL





Code below produces this error "Microsoft JET Database Engine error

'80040e14' Syntax error (missing operator) in query Expression

'Email=jon@t...'. /Tour/UpdateTourQuiz.asp, line 68" I am at wit's

end. Please help!



Jon



By the way, Line 68 is the first "Conn.Execute(SQL)"



<%

Dim Conn, dbPath

  dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

  Set Conn = Server.CreateObject("ADODB.Connection")

  Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



if (Session("TourQuiz") = "Passed") then

	Dim SQL

	SQL = "UPDATE tblStudentData SET TourQuiz=Passed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

else

	SQL = "UPDATE tblStudentData SET TourQuiz=Failed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

end if

%>
Message #4 by "Beck, Michael" <MikeBeck@C...> on Tue, 2 Oct 2001 11:52:06 -0600
Make sure you have single quotes around your text fields.



SQL = "UPDATE tblStudentData SET TourQuiz='Passed' WHERE Email='" &

Session("Email") & "'"



Try that...



Mike





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

From: Jonathan Gravois [mailto:wynnewade@t...]

Sent: Monday, October 01, 2001 10:52 PM

To: Access ASP

Subject: [access_asp] Something is wrong with this SQL





Code below produces this error "Microsoft JET Database Engine error

'80040e14' Syntax error (missing operator) in query Expression

'Email=jon@t...'. /Tour/UpdateTourQuiz.asp, line 68" I am at wit's

end. Please help!



Jon



By the way, Line 68 is the first "Conn.Execute(SQL)"



<%

Dim Conn, dbPath

  dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

  Set Conn = Server.CreateObject("ADODB.Connection")

  Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



if (Session("TourQuiz") = "Passed") then

	Dim SQL

	SQL = "UPDATE tblStudentData SET TourQuiz=Passed WHERE Email=" &

Session("Email")	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

else

	SQL = "UPDATE tblStudentData SET TourQuiz=Failed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

end if

%>








Message #5 by "Beck, Michael" <MikeBeck@C...> on Tue, 2 Oct 2001 11:58:59 -0600
Also I would write this code as 



<%

Dim Conn, dbPath

dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



Dim SQL

   If (Session("TourQuiz") = "Passed") Then

	SQL = "UPDATE tblStudentData SET TourQuiz='Passed' WHERE Email='" &

Session("Email") & "'"

   Else

	SQL = "UPDATE tblStudentData SET TourQuiz='Failed' WHERE Email='" &

Session("Email") & "'"

   End If

Conn.Execute(SQL)

Conn.Close

Response.Redirect "../MemberHome.asp"

%>



This way only the SQL statement changes according to the value of the

TourQuiz, not all of the connection values. This is less code to write and

maintain.



Mike









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

From: Frank Kech [mailto:fkech@s...]

Sent: Tuesday, October 02, 2001 6:33 AM

To: Access ASP

Subject: [access_asp] RE: Something is wrong with this SQL





Jonathan, I see two problems. 1) you are only Dimensioning SQL if "TourQuiz"

passed. Should move up the Dim higher in the logic chain. 2) I don't see the

ending " mark and ; at the end of the SQL statement.   -Frank







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

From: Jonathan Gravois [mailto:wynnewade@t...]

Sent: Monday, October 01, 2001 11:52 PM

To: Access ASP

Subject: [access_asp] Something is wrong with this SQL





Code below produces this error "Microsoft JET Database Engine error

'80040e14' Syntax error (missing operator) in query Expression

'Email=jon@t...'. /Tour/UpdateTourQuiz.asp, line 68" I am at wit's

end. Please help!



Jon



By the way, Line 68 is the first "Conn.Execute(SQL)"



<%

Dim Conn, dbPath

  dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

  Set Conn = Server.CreateObject("ADODB.Connection")

  Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



if (Session("TourQuiz") = "Passed") then

	Dim SQL

	SQL = "UPDATE tblStudentData SET TourQuiz=Passed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

else

	SQL = "UPDATE tblStudentData SET TourQuiz=Failed WHERE Email=" &

Session("Email")

	Conn.Execute(SQL)

	Conn.Close

	Response.Redirect "../MemberHome.asp"

end if

%>---



Message #6 by riley@i... on Sat, 13 Oct 2001 05:12:02
Mikes code looks just about perfect to me, I would make just one little 

change..



<%

 Dim Conn, dbPath

 dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

 Set Conn = Server.CreateObject("ADODB.Connection")

 Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath

 

 Dim SQL

    

 SQL = "UPDATE tblStudentData SET TourQuiz='"& Session("TourQuiz")&"'WHERE 

Email='" & Session("Email") & "'"

 Conn.Execute(SQL)

 Conn.Close

 Response.Redirect "../MemberHome.asp"

 %>

This is a little leaner, but will only work if possible values for session

("TourQuiz") is either Passed or Failed.  I'm assuming it is based on what 

I saw above.





> Also I would write this code as 

> 

> <%

> Dim Conn, dbPath

> dbPath = "d:\inetpub\wwwroot\youthonestop_org\Data\YouthOneStopData.mdb"

> Set Conn = Server.CreateObject("ADODB.Connection")

> Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath

> 

> Dim SQL

>    If (Session("TourQuiz") = "Passed") Then

> 	SQL = "UPDATE tblStudentData SET TourQuiz='Passed' WHERE Email='" &

> Session("Email") & "'"

>    Else

> 	SQL = "UPDATE tblStudentData SET TourQuiz='Failed' WHERE Email='" &

> Session("Email") & "'"

>    End If

> Conn.Execute(SQL)

> Conn.Close

> Response.Redirect "../MemberHome.asp"

> %>

> 

> This way only the SQL statement changes according to the value of the

> TourQuiz, not all of the connection values. This is less code to write 

and

> maintain.

> 

> Mike

> 

> 


  Return to Index