Click here to Skip to main content
15,886,796 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
I am using MS VS2008 building in C# and rather green since most of my programming was done in C++. I'm currently using an FTP component to download a csv of names,phone numbers,device type, status, ect and then parse it into a table using the OLEdb adapter. What becomes my issue is that the first row of information isn't set as the column names. Instead what i get in my gridview is F1,F2, ect. and then the first row of the csv is brought in at the top. My second issue regarding that is that in the first row the column titles that have numbers (ie the number column) the title doesn't come up.
so my first few rows would look like this (where f1,f2 are the titles of the columns above the table itself.

--F1-----------F2----------F3-----------F4---
Name ------ (blank) --- device type -- status --
myname ---1234567 -- SmartPhone -- active --
how do i get the name, phone number, device type, status up into where the F1,F2 ect are? This may solve my second issue, but for the sake of clarification how do I get the word Phone Number to come up without turning the number into a string?

here is a sample of the CSV
Name,PhoneNum,Device Type,Status
"my name",1234567,SmartPhone,active
Posted
Updated 21-Apr-11 5:20am
v2

1 solution

In your OLEDB connection string add HDR=YES.
 
Share this answer
 
Comments
TeddyB777 21-Apr-11 11:21am    
works and solves both issues. Thanks
Nish Nishant 21-Apr-11 11:24am    
You are welcome.

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