I have a program that runs a WMI query and writes the data to a temp CSV file then imports that data into a datagrid so the user is able to view the data. When I have this data in the temp file like this:
Code:
Server Disk Configuration for myServer
Caption, ConfigManagerErrorCode, Description, DeviceID, DriveType, ErrorDescription, Filesystem, MediaType, Name, TotalCapacity, Status, FreeSpace
It displays in the datagridview perfectly fine.... but when I have this temp CSV file displayed in the grid:
It doesn't display properly in the grid view. It displays like the image below. What could be wrong? I am just loading the CSV file though an OleDb connection like this:
vb Code:
Dim objConn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & ";Extended Properties=""Text;HDR=No;FMT=Delimited""")
Dim objDataAdapter As New OleDb.OleDbDataAdapter()
Dim objDataSet As New DataSet
Dim objCommand As New OleDb.OleDbCommand("SELECT * FROM tmp_output.csv", objConn)
objConn.Open()
objDataAdapter.SelectCommand = objCommand
objDataSet.Clear()
objDataAdapter.Fill(objDataSet, "CSV")
DataGridView.DataSource = objDataSet.Tables(0)
For intColumnIndex As Integer = 0 To DataGridView.Columns.Count - 1