[RESOLVED] SQL Server Text field to text box
I have an old database that still contains depreciated Text fields. I need to pull from these fields and display the results. You would think this should be easy...
First my select statement caused a problem:
Code:
SELECT DISTINCT ..., CustomerInstructions, ... FROM Orders
where CustomerInstructions is a Text field.
The error I get: "The text data type cannot be selected as DISTINCT because it is not comparable." A quick search shows I can cast the text field as a varchar(max).
Code:
SELECT DISTINCT ..., CAST(CustomerInstructions AS VARCHAR(MAX)), ... FROM Orders
Now I get an error while trying to load the instructions into a text box: "Specified argument was out of the range of valid values. Parameter name: index"
Not sure what the problem is here. I have text and a text box. What's with the "out of range" crap?
Re: SQL Server Text field to text box
What does the code look like when loading it into the textbox? I just noticed that after you cast it, you didn't give the column a name... so if you're trying to reference it by the name CustomerInstrucitons... it doesn't exist... thus it's out of range... alias the field as CustomerInstructions and it should work again.
-tg
Re: SQL Server Text field to text box
This whole project was written in 2003 and I'm not having much fun fixing it...
I ended up solving my problems by dropping the DISTINCT since duplicate records aren't a problem. Not sure why it was added to begin with.