I'm writing some simple queries which return a single value and I'd like to get the ADO.NET ExecuteScalar method's behavior from Classic ASP's ADO libary. However, I'd prefer to not re-invent the wheel. Is it possible to instantiate ADO.NET's Command object within classic ASP? If so, how would I go about doing that?
If I do need to re-implement this feature, what is the best way to do that?
Here's what I'm trying to do (In VBScript):
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandText = "SELECT COUNT(*) FROM corp_crcchallenge WHERE cc_email = ?"
appendParam cmd, "email", adVarChar, adParamInput, 255, email
emailFound = cmd.ExecuteScalar()
appendParam is a subroutine I made to append the param so I wouldn't have to repeat myself too much in another part of this app. It makes it a bit easier to read.
I'm thinking that something like the below might be the right direction if I need to re-implement. (Again VBScript)
emailFound = cmd.Execute(Nothing, Nothing, adExecuteRecord)