Click to See Complete Forum and Search --> : ADODB.Recordset & ADODB.Command to perform search using wildcards


vadims
04-06-2009, 05:16 AM
I hope that this is the correct forum to post this.

I've made a search page using two different ways.
- ADODB.Recordset
Set searchRS = Server.CreateObject("ADODB.Recordset")
searchRS.ActiveConnection = myConnStr
searchRS.Source = "SELECT * FROM products WHERE (productTitle like '%" + varKey + "%' OR productDesciption like '%" + varKey + "%')"

- ADODB.Command
Set searchRS_cmd = Server.CreateObject ("ADODB.Command")
searchRS_cmd.ActiveConnection = myConnStr
searchRS_cmd.CommandText = "SELECT * FROM products WHERE
(productTitle like ? OR productDesciption like ?)"
searchRS_cmd.Prepared = true
searchRS_cmd.Parameters.Append searchRS_cmd.CreateParameter("param1", 200, 1, 255, "%" + varKey + "%")
searchRS_cmd.Parameters.Append searchRS_cmd.CreateParameter("param2", 200, 1, 255, "%" + varKey + "%")

Now I want to search for a string with non latin characters e.g. greek. Normally the should both have the same results. Well they don't.
When using ADODB.Recordset the search results are always correct both for latin and non latin string but ADODB.Command mess up the results when searching for non latin string.
Is there any locale option for appending parameters into a ADODB.Command? Or am I doing something else wrong?

Thanks