Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing information in a datagrid to show text not numbers.

Status
Not open for further replies.

BSG75

Technical User
Mar 18, 2005
23
US
I have a application that is pulling data from several tables into a datagrid. I have to add a new table, but the table has only values, no descriptions for the values. I need to pull in the values and then change them to show the text value that they are associated with. I run a select statement and the table is Priority and it only has values in it. I have tried to run a Case statment to show Priority = 1 then 'Low', but it is not working. Any suggestions would be appreciated. adodc1.RecordSource = "SELECT HPD_HelpDesk.Submitted_By, DateAdd(s,HPD_HelpDesk.Assign_Time,'12/31/1969 18:00:00 PM') as Ticket_Assigned_Time, HPD_HelpDesk.Case_ID_, HPD_HelpDesk.SubItem, HPD_HelpDesk.Assigned_To_Individual_, HPD_HelpDesk.Priority FROM REMEDY_SUPPORT.dbo.HPD_HelpDesk " & _
"WHERE (HPD_HelpDesk.Assigned_To_Individual_='Leticia Najera' OR HPD_HelpDesk.Assigned_To_Individual_='Loretta G. Villarreal' OR HPD_HelpDesk.Assigned_To_Individual_='Virginia S. Nevarez' OR HPD_HelpDesk.Assigned_To_Individual_='Robert G. Villa' OR HPD_HelpDesk.Assigned_To_Individual_='Calvin D. Drummond') " & _
"AND (HPD_HelpDesk.SubItem <> 'New Printer ID Assignments' AND HPD_HelpDesk.SubItem <> 'EFS Install' AND HPD_HelpDesk.SubItem <> 'Changes to Location Table' AND HPD_HelpDesk.SubItem <> 'Needs more Instant Data Reports Added to site' AND HPD_HelpDesk.SubItem <> 'Setup') " & _
"AND (DATEADD(s, Assign_Time, '12/31/1969 18:00:00 PM') > '" & Date & "')" & "ORDER BY DATEADD(s, Assign_Time, ' 12/31/1969 18:00:00 PM ') DESC"
Adodc1.Refresh
 
The Priorities that i have are Priority = (0) then 'Low', Priority = (1) then 'Medium', Priority = 2 then high and then Prioirty = 3 then urgent.
 
I am pulling the information from a SQL database.
 
How did you have your case statement?
Been a while since I used SQLServer but would it work like this?:
Code:
select Case Priority = 0 then 'Low' else Priority = 1 then 'Medium' else...etc End
From...
Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
I was using the select statement this way: CASE

dbo.HPD_HelpDesk.Priority

WHEN '0' THEN 'Low'

WHEN '1' THEN 'Medium'

WHEN '2' THEN 'High'

WHEN '3' THEN 'Urgent'

WHEN '4' THEN ' '

END AS Priority,

when i did this it did not recognize the (') it turned everyting into comments.
 
No i just tried it and it tells me that it do incorrect syntax near (=).
 
SELECT Case Priority = 0 then 'Low' end HPD_HelpDesk.Submitted_By, DateAdd(s,HPD_HelpDesk.Assign_Time,'12/31/1969 18:00:00 PM') as Ticket_Assigned_Time, HPD_HelpDesk.Case_ID_, HPD_HelpDesk.SubItem, HPD_HelpDesk.Assigned_To_Individual_, HPD_HelpDesk.Priority FROM REMEDY_SUPPORT.dbo.HPD_HelpDesk " & _
"WHERE (HPD_HelpDesk.Assigned_To_Individual_='Leticia Najera' OR HPD_HelpDesk.Assigned_To_Individual_='Loretta G. Villarreal' OR HPD_HelpDesk.Assigned_To_Individual_='Virginia S. Nevarez' OR HPD_HelpDesk.Assigned_To_Individual_='Robert G. Villa' OR HPD_HelpDesk.Assigned_To_Individual_='Calvin D. Drummond') " & _
"AND (HPD_HelpDesk.SubItem <> 'New Printer ID Assignments' AND HPD_HelpDesk.SubItem <> 'EFS Install' AND HPD_HelpDesk.SubItem <> 'Changes to Location Table' AND HPD_HelpDesk.SubItem <> 'Needs more Instant Data Reports Added to site' AND HPD_HelpDesk.SubItem <> 'Setup') " & _
"AND (DATEADD(s, Assign_Time, '12/31/1969 18:00:00 PM') > '" & Date & "')" & "ORDER BY DATEADD(s, Assign_Time, ' 12/31/1969 18:00:00 PM ') DESC"
Adodc1.Refresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top