|
 |
asp_databases thread: ASP Runtime Error
Message #1 by "varun" <varun25@y...> on Sun, 17 Sep 2000 21:12:28 +0100
|
|
Hi, I'm developing WAP applications and i'm using ASP for database
integration. i'm using IIS 5.0 , Access 2000 and UP SDK 4.0 emulator.The
application works up to a point where i get a HTTP 500 Error. When I try
to be-bug using Inter Dev I get the following message
"An exception of tyoe Microsoft OLEDB Provider for ODBC Driver
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updatable
query was not handled "
Can anyone shed some light???
here is the code listing<!--#include file="conn.asp" --><%
'send the right MIME type
Response.ContentType = "text/vnd.wap.wml"
%><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<%
Dim SQLquery, SQLInsert, SQLUpdate
Dim rsShow, rsMovie, rsTheater, rsBooking
Dim show_id, movie_id, movie_title, time, theater_id, theater_name,
free_seats, tickets, error
Dim maxbookid
show_id = Request("show_id")
tickets = Request("ticket")
error = false
SQLquery = "SELECT * FROM show WHERE Show_id = " & show_id
set rsShow = conn.Execute(SQLquery)
movie_id = rsShow("Movie_ID")
theater_id = rsShow("Theater_ID")
time = rsShow("time")
free_seats = rsShow("free_seats")
if CInt(free_seats) < CInt(tickets) then
error = true
else
free_seats = free_seats - tickets
end if
'get hold of the film
sqlQuery = "SELECT title FROM movie WHERE Movie_id = " & movie_id
set rsMovie = conn.Execute(sqlQuery)
movie_title = rsMovie("title")
rsMovie.close
set rsMovie = nothing
'get hold of the cinema
sqlQuery = "SELECT name FROM theater WHERE Theater_id = " & theater_id
set rsTheater = conn.Execute(sqlQuery)
theater_name = rsTheater("name")
rsTheater.close
set rsTheater = nothing
'close the show recordset
rsShow.close
set rsShow = nothing
%>
<card id="card1" title="Confirm" newcontext="true">
<p>
<%
if error then
Response.write("Sorry, looks like someone was faster than you")
Response.write("</p></card></wml>")
Response.end
end if
SQLUpdate = "UPDATE Show " &_
" SET Show.free_seats=" & free_seats & " " &_
" WHERE Show_ID=" & show_id
conn.Execute(SQLUpdate) (THE DE-BUGGING SHOWS AN ERROR IN THIS LINE
)
SQLquery = "SELECT max([Booking_ID]) as bookingnumber FROM booking"
Set rsBooking = conn.execute(SQLquery)
maxbookid = rsBooking("bookingnumber") + 1
SQLinsert = "INSERT INTO Booking ( show_id, booked_seats ) " & _
"VALUES ('" & show_id & "', '" & tickets & "')"
conn.Execute(SQLinsert)
%>
You have booked <%=tickets%> ticket(s) for
<%=movie_title%><br />
The show will take place at <%=theater_name%> (<%=time%>)
<br />
Your reference number is <%=maxbookid%>
<br />
Thank you
<small>
<anchor title="Start">Go to start
<go href="step1.asp" />
</anchor>
</small>
</p>
</card>
</wml>
Message #2 by "Asmadi Ahmad" <chloro@e...> on Mon, 18 Sep 2000 15:34:14 +0800
|
|
I sometimes got the same error for normal Web based access to database.
I am not sure how I solved it last time but I remember closing the conn and
setting it to nothing and reset the PWS. I noticed u didn't close conn in
your code.
asmadi
www.effitech.com
----- Original Message -----
From: varun <varun25@y...>
To: ASP Databases <asp_databases@p...>
Sent: Monday, 18 September, 2000 4:12 AM
Subject: [asp_databases] ASP Runtime Error
> Hi, I'm developing WAP applications and i'm using ASP for database
> integration. i'm using IIS 5.0 , Access 2000 and UP SDK 4.0 emulator.The
> application works up to a point where i get a HTTP 500 Error. When I try
> to be-bug using Inter Dev I get the following message
> "An exception of tyoe Microsoft OLEDB Provider for ODBC Driver
> [Microsoft][ODBC Microsoft Access Driver] Operation must use an updatable
> query was not handled "
>
> Can anyone shed some light???
> here is the code listing<!--#include file="conn.asp" --><%
> 'send the right MIME type
> Response.ContentType = "text/vnd.wap.wml"
> %><?xml version="1.0"?>
> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
> <wml>
>
> <%
> Dim SQLquery, SQLInsert, SQLUpdate
> Dim rsShow, rsMovie, rsTheater, rsBooking
>
> Dim show_id, movie_id, movie_title, time, theater_id, theater_name,
> free_seats, tickets, error
> Dim maxbookid
>
> show_id = Request("show_id")
> tickets = Request("ticket")
> error = false
>
> SQLquery = "SELECT * FROM show WHERE Show_id = " & show_id
> set rsShow = conn.Execute(SQLquery)
>
> movie_id = rsShow("Movie_ID")
> theater_id = rsShow("Theater_ID")
>
> time = rsShow("time")
> free_seats = rsShow("free_seats")
>
> if CInt(free_seats) < CInt(tickets) then
> error = true
> else
> free_seats = free_seats - tickets
> end if
>
> 'get hold of the film
> sqlQuery = "SELECT title FROM movie WHERE Movie_id = " & movie_id
> set rsMovie = conn.Execute(sqlQuery)
> movie_title = rsMovie("title")
> rsMovie.close
> set rsMovie = nothing
>
> 'get hold of the cinema
> sqlQuery = "SELECT name FROM theater WHERE Theater_id = " & theater_id
> set rsTheater = conn.Execute(sqlQuery)
> theater_name = rsTheater("name")
> rsTheater.close
> set rsTheater = nothing
>
> 'close the show recordset
> rsShow.close
> set rsShow = nothing
>
> %>
>
> <card id="card1" title="Confirm" newcontext="true">
> <p>
>
> <%
>
> if error then
> Response.write("Sorry, looks like someone was faster than you")
> Response.write("</p></card></wml>")
> Response.end
> end if
>
> SQLUpdate = "UPDATE Show " &_
> " SET Show.free_seats=" & free_seats & " " &_
> " WHERE Show_ID=" & show_id
> conn.Execute(SQLUpdate) (THE DE-BUGGING SHOWS AN ERROR IN THIS LINE
> )
>
>
> SQLquery = "SELECT max([Booking_ID]) as bookingnumber FROM booking"
>
> Set rsBooking = conn.execute(SQLquery)
> maxbookid = rsBooking("bookingnumber") + 1
>
> SQLinsert = "INSERT INTO Booking ( show_id, booked_seats ) " & _
> "VALUES ('" & show_id & "', '" & tickets & "')"
> conn.Execute(SQLinsert)
>
>
> %>
>
> You have booked <%=tickets%> ticket(s) for
> <%=movie_title%><br />
> The show will take place at <%=theater_name%> (<%=time%>)
> <br />
> Your reference number is <%=maxbookid%>
> <br />
>
> Thank you
>
> <small>
> <anchor title="Start">Go to start
> <go href="step1.asp" />
> </anchor>
> </small>
>
> </p>
> </card>
> </wml>
>
>
>
Message #3 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Mon, 18 Sep 2000 10:00:26 +0200
|
|
Looking at this 2 sentences
1.- SQLUpdate = "UPDATE Show " &_
" SET Show.free_seats=" & free_seats & " " &_
" WHERE Show_ID=" & show_id
2.- SQLinsert = "INSERT INTO Booking ( show_id, booked_seats ) " & _
"VALUES ('" & show_id & "', '" & tickets & "')"
it seems that sometimes your show_id is an integer and other times is an
string.
Not very consistent. It seems that perhaps free_seats and show_id fields are
text fields. Would it be the case you must UPDATE using ' ' in your SQL.
I recommend u two things:
You should use one recordset with a sql sentence with two joins instead of
opening three recordset. It's much faster.
You should be careful with the update. If you have many people accessing
your database at the same time you are going to have problems. You must lock
your database from the start of the page until the update if you don't want
to sell more seats that the ones you actually have.
Regards,
Gonzalo
-----Mensaje original-----
De: varun [mailto:varun25@y...]
Enviado el: domingo, 17 de septiembre de 2000 22:12
Para: ASP Databases
Asunto: [asp_databases] ASP Runtime Error
Hi, I'm developing WAP applications and i'm using ASP for database
integration. i'm using IIS 5.0 , Access 2000 and UP SDK 4.0 emulator.The
application works up to a point where i get a HTTP 500 Error. When I try
to be-bug using Inter Dev I get the following message
"An exception of tyoe Microsoft OLEDB Provider for ODBC Driver
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updatable
query was not handled "
Can anyone shed some light???
here is the code listing<!--#include file="conn.asp" --><%
'send the right MIME type
Response.ContentType = "text/vnd.wap.wml"
%><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<%
Dim SQLquery, SQLInsert, SQLUpdate
Dim rsShow, rsMovie, rsTheater, rsBooking
Dim show_id, movie_id, movie_title, time, theater_id, theater_name,
free_seats, tickets, error
Dim maxbookid
show_id = Request("show_id")
tickets = Request("ticket")
error = false
SQLquery = "SELECT * FROM show WHERE Show_id = " & show_id
set rsShow = conn.Execute(SQLquery)
movie_id = rsShow("Movie_ID")
theater_id = rsShow("Theater_ID")
time = rsShow("time")
free_seats = rsShow("free_seats")
if CInt(free_seats) < CInt(tickets) then
error = true
else
free_seats = free_seats - tickets
end if
'get hold of the film
sqlQuery = "SELECT title FROM movie WHERE Movie_id = " & movie_id
set rsMovie = conn.Execute(sqlQuery)
movie_title = rsMovie("title")
rsMovie.close
set rsMovie = nothing
'get hold of the cinema
sqlQuery = "SELECT name FROM theater WHERE Theater_id = " & theater_id
set rsTheater = conn.Execute(sqlQuery)
theater_name = rsTheater("name")
rsTheater.close
set rsTheater = nothing
'close the show recordset
rsShow.close
set rsShow = nothing
%>
<card id="card1" title="Confirm" newcontext="true">
<p>
<%
if error then
Response.write("Sorry, looks like someone was faster than you")
Response.write("</p></card></wml>")
Response.end
end if
SQLUpdate = "UPDATE Show " &_
" SET Show.free_seats=" & free_seats & " " &_
" WHERE Show_ID=" & show_id
conn.Execute(SQLUpdate) (THE DE-BUGGING SHOWS AN ERROR IN THIS LINE
)
SQLquery = "SELECT max([Booking_ID]) as bookingnumber FROM booking"
Set rsBooking = conn.execute(SQLquery)
maxbookid = rsBooking("bookingnumber") + 1
SQLinsert = "INSERT INTO Booking ( show_id, booked_seats ) " & _
"VALUES ('" & show_id & "', '" & tickets & "')"
conn.Execute(SQLinsert)
%>
You have booked <%=tickets%> ticket(s) for
<%=movie_title%><br />
The show will take place at <%=theater_name%> (<%=time%>)
<br />
Your reference number is <%=maxbookid%>
<br />
Thank you
<small>
<anchor title="Start">Go to start
<go href="step1.asp" />
</anchor>
</small>
</p>
</card>
</wml>
---
You are currently subscribed to asp_databases
|
|
 |