Skeen
Sep 20th, 2000, 04:45 AM
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
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