How do I force SqlDataSource to use varchar parameters?
I am using SqlDataSource to populate my GridView because the two seem to be so closely related to each other. Since this grid is showing search results, I have a dynamic sql string written in my code that references the parameters I pass, like below:
sdsResults.SelectParameters.Add("CodeID", TypeCode.String, strCodeID)
My problem is that the CodeID field is a varchar field. As you can see, jumping into an nvarchar field to evaluate against a varchar field can be very detrimental to sql performance. However, SelectParameters.Add only accepts TypeCode types, which seems to give me a unicode TypeCode.String as my viable option.
How do I make the SqlDataSource use varchars? I can't change the datatype at the moment - this is the master key of a large 10 year old application, and frankly varchar is fine for the application.