Hi all:
I have a csv file that I'm populating a dataset and then a datagrid. One field has very long strings (CC NUM), and it is displaying it in scientific #'s, like Excel.
I've set the datatype to system.string...
You'll probably get more use out of the code than my yammering.
Everything else loads fine.
Any ideas?
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
I have a csv file that I'm populating a dataset and then a datagrid. One field has very long strings (CC NUM), and it is displaying it in scientific #'s, like Excel.
I've set the datatype to system.string...
You'll probably get more use out of the code than my yammering.
Code:
Sub OpenDXP()
Dim i As Integer
Dim s As String
Dim conCSV As ADODB.Connection
Dim rsCSV As ADODB.Recordset
Dim SQL As String
conCSV = New ADODB.Connection
rsCSV = New ADODB.Recordset
conCSV.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & txtDir.Text & ";Extended Properties=""text;HDR=Yes;FMT=Delimited"""
conCSV.Open(conCSV.ConnectionString)
SQL = "SELECT * FROM " & RD + strDate + ".csv"
rsCSV.Open(SQL, conCSV, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, ADODB.CommandTypeEnum.adCmdText)
DS = New DataSet("DS1")
TBL = New DataTable("TBL1")
For i = 0 To rsCSV.Fields.Count - 1
DC = New DataColumn(rsCSV.Fields(i).Name)
DC.DataType = System.Type.GetType("System.String")
TBL.Columns.Add(DC)
Next
Do While Not rsCSV.EOF
DR = TBL.NewRow
For i = 0 To rsCSV.Fields.Count - 1
DR(rsCSV.Fields(i).Name) = rsCSV(i).Value
Next
rsCSV.MoveNext()
TBL.Rows.Add(DR)
Loop
DS.Tables.Add(TBL)
DG2.CaptionText = RD + strDate + ".csv"
DG2.SetDataBinding(DS, "TBL1")
End Sub
Everything else loads fine.
Any ideas?
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.