Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while filling a datatable from a csv files those columns while contaion mixed datatype e.g. text,numeric in csv file, are coming as blank in datatable

below is the code that i m using

VB
Dim csvFileFolder As String = _PATH
            Dim csvFileName As String = _FILE

            Dim connString As String = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
                & csvFileFolder & ";Extended Properties=""Text;HDR=No;FMT=Delimited"""

            Dim conn As New Odbc.OdbcConnection(connString)

            'Open a data adapter, specifying the file name to load
            Dim da As New Odbc.OdbcDataAdapter("SELECT * FROM [" & csvFileName & "]", conn)

            'Then fill a data table, which can be bound to a grid
            Dim dt As New DataTable
            da.Fill(dt)
Posted
Updated 2-May-13 18:36pm
v2
Comments
Kschuler 2-May-13 12:17pm    
Without seeing the data that the csv contains and your code, we really don't have enough information to help you. Please click the Improve Question link and add more information to your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900