hello
the promblem is when i want decrement the value of field in database didn't work like this:
copy=rs.fields( "num_copies").v alue;
copy=copy-1;
then i want update the value of field (num_copies) in database
the promblem is when i want decrement the value of field in database didn't work like this:
copy=rs.fields( "num_copies").v alue;
copy=copy-1;
then i want update the value of field (num_copies) in database
Code:
<%@language="javascript"%>
<!--#include file="connection.asp"-->
<%
RS.open("SELECT *FROM book_info where (num ="+Request.form("No_Book")+")and(title_book='"+Request.form("Book1")+"')",abCon);
if(!RS.EOF)
{
if( RS.fields("num_copies").value >1)
{
copy=RS.fields("num_copies").value;
rent=RS.fields("Rent_book").value;
copy=copy-1;
rent=rent+1;
RS.Fields("num_copies")=copy;
RS.Fields("Rent_book")=rent;
RS.Update;
RS.Close;
abCon.close;
}
else
{
Response.write("There is no enogh copies of this book");
RS.close;
abCon.close;
}
}
%>
Comment