SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 9th, 2003, 04:27 AM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Unhappy expected end of statement

i am tryign since long and unable to get the solution :-(

this is the query :
StAge = Request.form("stdAge")

QUERY1 = "INSERT INTO student_info (student_id,student_name,student_username, student_password,student_age) VALUES ("5",'"&Session("newStdName")&"','"&Session("newStdUserName")&"','"&Session("NewStdPassword")&"','"&stAge&"')"

my errir:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/myweb2/saveNewStudent.asp, line 31, column 117
QUERY1 = "INSERT INTO student_info (student_id,student_name,student_username, student_password,student_age) VALUES ("5",'"&Session("newStdName")&"','"&Session("newStdUserName")&"','"&Session("NewStdPassword")&"','"&stAge&"')"
--------------------------------------------------------------------------------------------------------------------^

the last field in access is of number type (student_age)

Reply With Quote
  #2  
Old September 9th, 2003, 07:38 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Try this:

<%
Dim StAge
Dim QUERY1

StAge = Trim(Replace(Request.form("stdAge"),"'","''"))
'FOR DEBUG ONLY
'Response.Write "-->" & StAge & "<--"
'Response.End

'You could make a validation if you wanted to on the variable *StAge*
'For example:
'If StAge = "" Then
' Response.Write "no Age value was given...please try again"
' Response.End
'End If

QUERY1 = "INSERT INTO student_info (student_id, student_name, student_username, " & _
"student_password, student_age) " & _
"VALUES ("5", '" & Session("newStdName") & "', '" & Session("newStdUserName") & "', " & _
"'" & Session("NewStdPassword") & "', '" & stAge & "')"
'FOR DEBUG ONLY
'Response.Write QUERY1 & "<hr>"
'Response.End
%>

Copy/paste it in your code and see if it works

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old September 30th, 2003, 03:05 AM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
if your stAge is number type then you should not use the single quote (') when inserting.

Code:
" & stAge & ")" 
& not
Code:
'" & stAge & "')" 

hope my reply is not too late

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > expected end of statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway