syntax error!!! PLS HeLP

Results 1 to 2 of 2

Thread: syntax error!!! PLS HeLP

  1. #1
    Join Date
    Dec 1969

    Default syntax error!!! PLS HeLP

    i has problem in the if then statement .if i enter biggest value than the value of "quantity" in the database it work fine but it seems that not working even thoguht i insert the smaller than the quantity value in the access database ,it display the "have not" and suppose to be the go to "else statement"!!! why?<BR><BR><BR>&#060;%<BR>dim objconn<BR>dim rs<BR>dim sql2<BR>dim strquantity<BR>dim strproductid<BR><BR>set objconn=server.CreateObject("ADODB.connection")<BR ><BR>objconn.Open "DSN=agencyaccess"<BR><BR>set rs=server.CreateObject("ADODB.recordset")<BR>strqu antity = Request.Form("Quantity")<BR>strproductid = Request.Form("prodtid")<BR><BR>sql2 = "select Quantity from Product_Master where Product_ID = &#039"&strproductid&"&#039"<BR>set rs= objconn.Execute(sql2)<BR><BR>&#039Response.Write rs(0)<BR>&#039Response.Write strquantity<BR>if not strquantity &#062; rs(0) then<BR>&#039Response.Write rs("Quantity")<BR>Response.Write "have not"<BR>else sql="Update Product_Master " <BR>sql=sql & "set Quantity =Quantity - &#039"&strquantity&"&#039 "<BR>sql=sql & "where Product_ID =&#039"&strproductid&"&#039 "<BR><BR>Response.Write "the value has been added!!!"<BR>set rs=objconn.Execute(sql)<BR><BR>end if<BR>Response.Write sql<BR><BR>&#039rs.Close<BR>&#039set rs=nothing<BR><BR>%&#062;

  2. #2
    peter T. Guest

    Default RE: syntax error!!! PLS HeLP

    I am not sure what you are trying to do. But I can guess from your codes that you try to compare strquantity to Quantity from the database. If strquantity less than Quantity, you display "have not". If strquantity greater than Quantity, you update the database.<BR><BR>If what I guess is corrected, you have no problem. If not, you can try this. I take out the word "not" in your if statement.<BR>Hope this will help.<BR><BR> if strquantity &#062; rs("Quantity") then<BR> Response.Write "have not"<BR> else <BR> sql="Update Product_Master " <BR> sql=sql & "set Quantity =Quantity - &#039"&strquantity&"&#039 "<BR> sql=sql & "where Product_ID =&#039"&strproductid&"&#039 "<BR> Response.Write "the value has been added!!!"<BR> set rs=objconn.Execute(sql)<BR> end if<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts