When writing parameterized queries in Classic ASP, I have been using the following syntax:
Set cmdConn = Server.CreateObject("ADODB.Command")
Set cmdConn.ActiveConnection = Conn
cmdConn.Prepared = True
SQL = " INSERT INTO myTable (column1, column2, column3) VALUES (?, ?, ?); "
Set newParameter = cmdConn.CreateParameter("@column1", ad_Integer, ad_ParamInput, Len(input1), input1)
cmdConn.Parameters.Append newParameter
Set newParameter = cmdConn.CreateParameter("@column2", ad_Integer, ad_ParamInput, Len(input2), input2)
cmdConn.Parameters.Append newParameter
Set newParameter = cmdConn.CreateParameter("@column3", ad_Integer, ad_ParamInput, Len(input3), input3)
cmdConn.Parameters.Append newParameter
cmdConn.CommandText = SQL
cmdConn.Execute
And I’m of the understanding (self-taught), that where I use @column1 when appending a new parameter, this allocates the parameter to that particular column. I could be wrong tho’. So this has totally confused me when trying to write a full-text query.
This is my original full-text query:
SQL = "SELECT * FROM myTable WHERE MATCH (column1, column2, column3) AGAINST ('"&input&"' IN BOOLEAN MODE)"
Could somebody show me what syntax to use for this query?
I would imagine the SQL would look like this:
SQL = "SELECT * FROM myTable WHERE MATCH (column1, column2, column3) AGAINST (? IN BOOLEAN MODE)"
But not sure what to put for the newParameter string. Any help and explanations gratefully received…
"@columnN"is the name of that parameter, and isn’t related to the columncolumnN. This field is optional, so it could be unspecified for all of your parameters if you are never going to use the name when referring to it.It can be used for retrieving the value of output and input/output parameters from the Command object, instead of referring to the parameter by the order in which it was appended to the Parameters collection. I believe that some DBMSs will also support using named parameters in the query string instead of ? (easier to read, presumably).
To answer your specific question,