|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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) |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
if your stAge is number type then you should not use the single quote (') when inserting.
Code:
" & stAge & ")" Code:
'" & stAge & "')" hope my reply is not too late ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > expected end of statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|