HI, I am using the following code to read an excel spreadsheet into a datagrid. The code works fine but I am left with the values showing, how can I format the results to show only 2 numbers after the decimal and the thousand seperator? (Using VB.NET) :
ColName Q1 Q2 Q3 Q4
1 123.456 45.6897 47.3587 12.5744
Sub ReadTestData()
Dim DBConnection = New OleDbConnection( _
"Provider=Microsoft.Jet.OL
EDB.4.0;" & _
"Data Source=" & Server.MapPath("~/excel/" & "7476073472" & ".xls") & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes""")
DBConnection.Open()
Dim SQLString As String = "SELECT * FROM [Test$]"
Dim DBCommand = New OleDbCommand(SQLString, DBConnection)
Dim DBReader As IDataReader = DBCommand.ExecuteReader()
GridView9.DataSource = DBReader
GridView9.DataBind()
DBReader.Close()
DBConnection.Close()
End Sub
thanks in advance
Start Free Trial