• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

Convert True/False value from Gridview into Number with

I am pulling in a field (tinyint) from a MySQL server and once its bound to the gridview it shows True or False....the database values only consist of 1,2 or 3...how can I get the actual value to show up?
Dim MyDataSet As New DataSet()
            Mycommand.Fill(MyDataSet)
            GridView1.DataSource = MyDataSet
            GridView1.DataBind()
 
 
 
            Dim DGTruck As BoundField = New BoundField()
            Dim DGOper As BoundField = New BoundField()
            Dim DGShift As BoundField = New BoundField()
            Dim DGDate As BoundField = New BoundField()
            Dim DGV1 As BoundField = New CheckBoxField()
 
            DGTruck.DataField = "Truck"
            DGTruck.HeaderText = "Truck"
            DGTruck.SortExpression = "Truck"
 
            DGOper.DataField = "Operator"
            DGOper.HeaderText = "Operator"
            DGOper.SortExpression = "Operator"
 
            DGShift.DataField = "Shift"
            DGShift.HtmlEncode = False
            'DGShift.DataFormatString = "{0:n)"
            DGShift.HeaderText = "Shift"
            DGShift.SortExpression = "Shift"
 
            DGDate.DataField = "Date"
            DGDate.DataFormatString = "{0:MM/dd/yyyy}"
            DGDate.HtmlEncode = False
            DGDate.HeaderText = "Date"
            DGDate.SortExpression = "Date"
 
            DGV1.DataField = "V1"
            DGV1.HeaderText = "Condition"
            DGV1.SortExpression = "V1"
 
 
            GridView1.Columns.Add(DGTruck)
            GridView1.Columns.Add(DGOper)
            GridView1.Columns.Add(DGShift)
            GridView1.Columns.Add(DGDate)
            GridView1.Columns.Add(DGV1)
            GridView1.DataSource = MyDataSet
            GridView1.DataBind()

Open in new window

0
ITHelper80
Asked:
ITHelper80
  • 2
  • 2
1 Solution
 
UnifiedISCommented:
Is it the field that goes in DGV1?  That's a checkbox.  You can define the column in your dataset as an int and it shouldn't convert it to boolean.
0
 
ITHelper80Author Commented:
Sorry, I should have specified the fied...no its DGShift.

But I suspect the conversion to int is what I am looking for...can you give me a snippet?
0
 
UnifiedISCommented:
It will depend somewhat on how you define your dataset but here's one way to create a column:
ds.Tables(0).Columns.Add(New DataColumn("DGShift", Type.GetType("System.Int32")))
0
 
ITHelper80Author Commented:
.Thanks but I ended up having to change the table type to VarChar to get it to work
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now