Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Query

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
GB
Not strictly an ASP question.

I came across this method of using a parameter query. It ends up much neater looking than using CreateParameter, so I was wondering if there is a huge snag I have overlooked?

SQLtemp = "SELECT * FROM CustRecords WHERE Cust_UserName = ? AND Cust_Password = ? "

set oCmd = server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = cnn
oCmd.CommandText = SQLtemp
set rst = oCmd.Execute (,Array(cuser,cuserpassword))
 
I'm not familiar with CreateParameter. Can you elaborate?

Also, the method you've shown above seems ok. I can't see any problems as you've got it listed.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I've only every seen CreateParameter used for stored procedures, but I guess the logic would be the same. You might want to consider testing the execution time between this and the other method to see which takes longer over a series of executions using the timer() method. Another option would be to grab my benchmark script - several examples if you search for "benchmark" in this forum or you can find a couple links in my archive (linked from my profile).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top