G
Guest
Hi
I have the foll csv fil
01,1211
02,1415
05,1101
10,0011
34,0000
03,1100
I have the following code that parse the text file and put the result in a datagrid but it is removing leading zeros so 01 is returned as 1. Why
Dim strFileName As String = "pos.txt
Dim strFilePath As String = "C:\test\
Dim dsCSV As New DataSe
Tr
Dim f As System.IO.Fil
If f.Exists(strFilePath & strFileName) The
Dim ConStr As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
strFilePath & ";Extended Properties=""Text;HDR=No;FMT=Delimited\""
Dim conn As New OleDb.OleDbConnection(ConStr
Dim daCSV As New OleDb.OleDbDataAdapter("Select * from " &
strFileName, ConStr
daCSV.Fill(dsCSV, "TextFile"
' MsgBox(dsCSV.Tables("TextFile").Rows.Count
End I
Catch ex As Exceptio
MessageBox.Show(ex.ToString
End Tr
DataGrid1.DataSource = dsCSV.Tables(0
I have the foll csv fil
01,1211
02,1415
05,1101
10,0011
34,0000
03,1100
I have the following code that parse the text file and put the result in a datagrid but it is removing leading zeros so 01 is returned as 1. Why
Dim strFileName As String = "pos.txt
Dim strFilePath As String = "C:\test\
Dim dsCSV As New DataSe
Tr
Dim f As System.IO.Fil
If f.Exists(strFilePath & strFileName) The
Dim ConStr As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
strFilePath & ";Extended Properties=""Text;HDR=No;FMT=Delimited\""
Dim conn As New OleDb.OleDbConnection(ConStr
Dim daCSV As New OleDb.OleDbDataAdapter("Select * from " &
strFileName, ConStr
daCSV.Fill(dsCSV, "TextFile"
' MsgBox(dsCSV.Tables("TextFile").Rows.Count
End I
Catch ex As Exceptio
MessageBox.Show(ex.ToString
End Tr
DataGrid1.DataSource = dsCSV.Tables(0