ASP Classic - Type mismatch: 'CInt' - Easy question

后端 未结 4 1990
南方客
南方客 2021-01-19 14:26

Having an issue with type conversion in ASP classic.

heres my code:

        Set trainingCost = Server.CreateObject(\"ADODB.Recordset\")
    strSQL3 =         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 14:29

    Potentially solving the wrong problem, depends on the type of Cost1 within the database but the code is looping through the records to generate a total.

    strSQL3 = "SELECT sum(cost1) FROM tblMain WHERE (Booked = 'Booked') AND (Paid IS NULL) AND (PaidDate BETWEEN '01/04/" & startyear & "' AND '31/03/" & endyear & "')"        
    trainingCost.Open strSQL3, Connection 
    

    etc and just read off the value as a total.

    I don't see why the RS is being looped to generate a sum when the database can do that work for you. All the conversion work it has generated just looks artifical.

提交回复
热议问题