C
colo
Hi! I have a problem which I think has a simple solution, but I can't
figure out why it's not working.
Some background...
I'm populating a GridView with info from an Access database like this:
Public Sub LoadGrid()
Dim ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;
DataSource=C:\DATABASE\NCP.mdb;"
Dim NCPCon As New SDO.OleDbConnection(ConnectionString)
Dim SQL As String = "SELECT * FROM TEST1_IN;"
Dim cmd As New SDO.OleDbCommand(SQL, NCPCon)
Dim adapter As New SDO.OleDbDataAdapter(cmd)
Dim dsTEST As New DataSet()
NCPCon.Open()
adapter.Fill(dsTEST, "TEST1")
NCPCon.Close()
GridView1.DataSource = dsTEST.Tables("TEST1")
GridView1.DataBind()
Me.DataBind()
End Sub
Then I try to format the data by using this in the RowDataBound event:
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(1).Text = Format(e.Row.Cells(1).Text,
"#,###.00")
End if
The problem is that when the table is rendered this generates a column
full of #,###.00 instead of the actual values like this:
Name Salary
Lucy #,###.00
John #,###.00
Mark #,###.00
etc...
why could it be that the format function does not work?
Thanks for your help!
figure out why it's not working.
Some background...
I'm populating a GridView with info from an Access database like this:
Public Sub LoadGrid()
Dim ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;
DataSource=C:\DATABASE\NCP.mdb;"
Dim NCPCon As New SDO.OleDbConnection(ConnectionString)
Dim SQL As String = "SELECT * FROM TEST1_IN;"
Dim cmd As New SDO.OleDbCommand(SQL, NCPCon)
Dim adapter As New SDO.OleDbDataAdapter(cmd)
Dim dsTEST As New DataSet()
NCPCon.Open()
adapter.Fill(dsTEST, "TEST1")
NCPCon.Close()
GridView1.DataSource = dsTEST.Tables("TEST1")
GridView1.DataBind()
Me.DataBind()
End Sub
Then I try to format the data by using this in the RowDataBound event:
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(1).Text = Format(e.Row.Cells(1).Text,
"#,###.00")
End if
The problem is that when the table is rendered this generates a column
full of #,###.00 instead of the actual values like this:
Name Salary
Lucy #,###.00
John #,###.00
Mark #,###.00
etc...
why could it be that the format function does not work?
Thanks for your help!