|
-
Sep 20th, 2000, 04:45 AM
#1
Thread Starter
Addicted Member
Hi Y'all
I'm having a bit of trouble converting data types using VBscript. I'm pulling numerical values from a database into a recordset, I then want to convert the values in the recordsets to inetgers so that I can perform mathematical opperations on them. Below are two lines of my code, the first one works, the second one gets an error saying:
" Automation type not supported in VBscript "
But it works for the first example - can anyone tell me where I'm going wrong?
Heres the code:
cmSQL = "SELECT PPM FROM Service_Details " _
& " WHERE Customer_ID = '" & Custom_ID & "' "
Set rsPRS = cnAcqAcc.Execute(cmSQL)
rsPRS.MoveFirst
PRS = int (rsPRS("PPM"))
pprs = (PRS /100 )
Response.Write(pprs)
This works fine, but the variable PPM is a whole number ie '10',
Heres the next bit that dosn't work, the variable pulled from the table is a sumation of all the values in the column - but I can't see how it would make any difference.
The SQL is ok, so it must be the 'int' function:
sSQL = "SELECT SUM(DurationSecs) AS TotalTime " _
& " FROM Opal_Data
& " WHERE DialledNumber = '" & PRSselecta & "' " _
& " AND StartDateTime >= " -
& " (To_Date('" & Starter & "', 'dd/MM/yyyy')) " _
& " AND EndDateTime <= " _
& " (To_Date( '" & Ender & "', 'dd/MM/yyyy')) "
Set rsTotTime = cnAcqAcc.Execute(sSQL)
rsTotTime.MoveFirst
TotTime = rsTotTime("TotalTime")
ToTime = int (TotTime)
ToTime2 = (ToTime/60)
Response.Write(ToTime2)
Any help would be greatly appreciated ( and would probably save my sanity!)
Cheers 'n' beers
Skeen
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Sep 21st, 2000, 12:32 PM
#2
Frenzied Member
Have you tried defining TotTime as a long and doing the following:
TotTime = Clng(rsTotTime("TotalTime"))
-
Sep 22nd, 2000, 02:42 AM
#3
Thread Starter
Addicted Member
No, I haven't tried using Long data type, I have sussed that from a record set 'Cint' must be used rather than standard int.
Cheers fro the info though, I haddn't considdered that as an option, but as they say, you live and learn.
Nice1,
Skeen
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|