This topic is locked

Version 9 issue for recordcount

9/23/2014 4:33:21 AM
ASPRunnerPro General questions
F
fsyeung author

When I direct convert my project from ver8.1 to ver.9, it cannot working the script that using the recordcount function. See the script as below and please point out what is wrong and give me a solution. Thanks
yy = Right(datepart("yyyy",date),2)
set rstmp = Server.CreateObject("ADODB.Recordset")

rstmp.open "select * from wh_list where yy ='"& yy & "'", dbConnection ,1,3

if not rstmp.eof then

nums = rstmp.recordcount + 1

else

nums = 1

end if

rstmp.close : set rstmp = nothing

whtxt= "WH" & yy & Right("0000" & nums,4)

dict("whno") = dbvalue(whtxt)

acaruson 9/23/2014



When I direct convert my project from ver8.1 to ver.9, it cannot working the script that using the recordcount function. See the script as below and please point out what is wrong and give me a solution. Thanks
yy = Right(datepart("yyyy",date),2)
set rstmp = Server.CreateObject("ADODB.Recordset")

rstmp.open "select * from wh_list where yy ='"& yy & "'", dbConnection ,1,3

if not rstmp.eof then

nums = rstmp.recordcount + 1

else

nums = 1

end if

rstmp.close : set rstmp = nothing

whtxt= "WH" & yy & Right("0000" & nums,4)

dict("whno") = dbvalue(whtxt)


Did you change ANYTHING in your project? Or did you simply open it in version 9 and try to build a new version?

The reason I ask is, I think version 9 is having trouble with opening a second connection string. But I could be wrong.

F
fsyeung author 9/23/2014

just simply open in version9 and run. when add new show error http 500

admin 9/23/2014

Make sure you use the latest build of ASPRunnerPro 9.0 (22736 at the moment).
In general the use or Recordset's recordcount property is not reliable. Better and more reliable approach is to use "select count(*) from ..." type of query for this purpose.

F
fsyeung author 9/23/2014

already test in last version, I will try your suggestion but please study what wrong in version 9.

F
fsyeung author 9/23/2014

Is it suitable in access data file, because I use a mdb?

F
fsyeung author 9/23/2014

I just amend the script by using the "select count" as bellow but still not working also display error http 500
yy = Right(datepart("yyyy",date),2)

mm = Right(datepart("m",date),2)

set rstmp = Server.CreateObject("ADODB.Recordset")

rstmp.open "select count(yy) as countyy from wh_list where yy ='"& yy & "'", dbConnection ,1,3

if not rstmp.eof then

nums = rstmp.countyy + 1

else

nums = 1

end if

rstmp.close : set rstmp = nothing

whtxt= "WH" & yy & Right("0000" & nums,4)

admin 9/24/2014

This code doesn't make any sense. Check examples in ASPRunnerPro manual or on the Internet on how to work with recordset results:

http://xlinesoft.com/asprunnerpro/docs/customquery.htm

http://webcheatsheet.com/asp/database_connection_to_MSSQL.php

F
fsyeung author 9/25/2014

would you help to amend my simple scripte with your profession skill and i still don't understand why it can work in version 8.1 or before. Thanks