Last post Nov 23, 2011 04:42 PM by Diomedes
Jul 08, 2011 02:00 PM|belkin|LINK
Hello. Have a column in the sql table that is a tiny int. This holds a 0 for No and 1 for Yes. There is a combobox that has the info in it. When I run the listview on the browser it shows a 0 or 1 in the field. Is there a way in the SelectCommand to
indicate what each is for and then show it on the browser?
Jul 08, 2011 02:37 PM|princeG|LINK
you need to Use CASE in your query
SELECT Col1, Col2,
WHEN 0 THEN 'No'
WHEN 1 THEN 'Yes'
Jul 08, 2011 02:44 PM|belkin|LINK
Here is the whole SelectCommand line. The tinyint field is IsISOCertified. I suspect I didn't add it right.
="SELECT [ID], [Status], [Name], [ContactName], [IsISOCertified], CASE IsISOCertified WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' END 'IsISOCertified' FROM [Suppliers] WHERE Status = 'Active'">
Jul 08, 2011 02:48 PM|belkin|LINK
I got it. Had forgotten to replace the first [IsISOCertified] with the CASE statement. Thanks for the help on this....John
="SELECT [ID], [Status], [Name], [ContactName], CASE IsISOCertified WHEN 0 THEN 'NO' WHEN 1 THEN 'YES' END 'IsISOCertified' FROM [Suppliers] WHERE Status = 'Active'"
Nov 23, 2011 04:42 PM|Diomedes|LINK
If you are just using it for 0 and 1 for yes and no, you can use datatype BIT instead of tinyint. Save some space. The case code for the yes and now would work the same.