I've tried in vain to search for examples using the parameter object of ADODB without using a stored procedure. How do you use a SQL statement in one's code, using parameters?
See this Microsoft Support topic to see what I mean:
Note these two lines:
objCmd.CommandText = "SampleQuery"
objCmd.CommandType = adCmdStoredProc
I want to know what the SampleQuery looks like as an SQL statement, such that objCmd.CommandText will be a SQL statement with multiple parameters in the WHERE clause, and objCmd.CommandType will be adCmdText.
Then, I want to know how to add the various parameters and their values, making sure this value corresponds to that part of the WHERE clause, and so forth:
Set objParam1 = objCmd.CreateParameter("@productid" , adInteger, adParamInput, 0, 0)
objCmd.Parameters.Append objParam1
Set objParam2 = objCmd.CreateParameter("@productamount" , adInteger, adParamInput, 0, 0)
objCmd.Parameters.Append objParam2
I hope you see what I mean. Any help would be greatly appreciated.
Christopher
See this Microsoft Support topic to see what I mean:
Note these two lines:
objCmd.CommandText = "SampleQuery"
objCmd.CommandType = adCmdStoredProc
I want to know what the SampleQuery looks like as an SQL statement, such that objCmd.CommandText will be a SQL statement with multiple parameters in the WHERE clause, and objCmd.CommandType will be adCmdText.
Then, I want to know how to add the various parameters and their values, making sure this value corresponds to that part of the WHERE clause, and so forth:
Set objParam1 = objCmd.CreateParameter("@productid" , adInteger, adParamInput, 0, 0)
objCmd.Parameters.Append objParam1
Set objParam2 = objCmd.CreateParameter("@productamount" , adInteger, adParamInput, 0, 0)
objCmd.Parameters.Append objParam2
I hope you see what I mean. Any help would be greatly appreciated.
Christopher