DataGrid - Custom values derived from database values

Aug 26 2010 11:40 AM

I have created and loaded a datagrid with values from a database.  I have two columns that are directly from the database and one column that is based off a value in the database.
The column derived from the database value essentially is based on the following pseudocode
If Issued_Quantity > 0, field value = Complete ("C")
Else, field value = Incomplete ("I")
Is there a way to incorporate this into the datagrid while still pulling two columns directly from the database?
My current code is as follows:

Dim dr As SqlCeDataReader
Dim dt As DataTable
Dim cmd As SqlCeCommand = New SqlCeCommand(sql, cn)
 
cn.Open()
dr = cmd.ExecuteReader
 
Using dr
dt =
New DataTable
dt.Load(dr)
cn.Close()
End Using
 
Return dt
 
dgPickIssue.DataSource = dt

Where the SQL statement is
 

SELECT pi.Requisition_Number as Requisition, i.Location as Location FROM Pick as pi INNER JOIN Item as i ON pi.Item_Key = i.Item_Key

The desired end result would look something like this:
Requisition Number | Location | Status
1230957389             | Bay 2       | I
4357892346             | Bay 6       | C
The values in the database for status would be '0' for the first record and a number like '25' for the second.
Thank you in advance for your help!

Answers (1)