Click here to Skip to main content
15,915,864 members
Home / Discussions / C#
   

C#

 
QuestionSerialize/Deserialize data class from different assemblies Pin
charian092026-May-09 19:29
charian092026-May-09 19:29 
AnswerRe: Serialize/Deserialize data class from different assemblies Pin
occcy26-May-09 20:58
occcy26-May-09 20:58 
GeneralRe: Serialize/Deserialize data class from different assemblies Pin
charian092026-May-09 23:44
charian092026-May-09 23:44 
AnswerRe: Serialize/Deserialize data class from different assemblies Pin
Giorgi Dalakishvili27-May-09 1:21
mentorGiorgi Dalakishvili27-May-09 1:21 
QuestionInformation obut BHO? Pin
Yukivi26-May-09 19:19
Yukivi26-May-09 19:19 
AnswerRe: Information obut BHO? Pin
Henry Minute27-May-09 0:49
Henry Minute27-May-09 0:49 
QuestionEDB file using C# Pin
vijaywithu26-May-09 19:10
vijaywithu26-May-09 19:10 
AnswerRe: EDB file using C# Pin
Colin Angus Mackay26-May-09 21:00
Colin Angus Mackay26-May-09 21:00 
GeneralRe: EDB file using C# Pin
vijaywithu26-May-09 23:02
vijaywithu26-May-09 23:02 
QuestionI want to use FoxPro DBF file Pin
M Riaz Bashir26-May-09 18:46
M Riaz Bashir26-May-09 18:46 
AnswerRe: I want to use FoxPro DBF file Pin
Mycroft Holmes26-May-09 19:47
professionalMycroft Holmes26-May-09 19:47 
GeneralRe: I want to use FoxPro DBF file Pin
M Riaz Bashir26-May-09 20:00
M Riaz Bashir26-May-09 20:00 
AnswerRe: I want to use FoxPro DBF file Pin
leung wilson26-May-09 21:06
leung wilson26-May-09 21:06 
QuestionDownloading all files in directory FTP C# Pin
jumbojs26-May-09 17:05
jumbojs26-May-09 17:05 
AnswerRe: Downloading all files in directory FTP C# Pin
Anubhava Dimri26-May-09 18:43
Anubhava Dimri26-May-09 18:43 
AnswerRe: Downloading all files in directory FTP C# Pin
stancrm26-May-09 20:45
stancrm26-May-09 20:45 
Questiondatagridtextbox column text changed event problem Pin
Shuaib wasif khan26-May-09 11:45
Shuaib wasif khan26-May-09 11:45 
AnswerRe: datagridtextbox column text changed event problem Pin
Henry Minute26-May-09 12:19
Henry Minute26-May-09 12:19 
GeneralRe: datagridtextbox column text changed event problem Pin
Shuaib wasif khan26-May-09 12:30
Shuaib wasif khan26-May-09 12:30 
AnswerRe: datagridtextbox column text changed event problem Pin
jaypatel51227-May-09 0:32
jaypatel51227-May-09 0:32 
QuestionNeed suggestion on getting column data from excel without using ADO or Excel Interops Pin
DeepToot26-May-09 10:29
DeepToot26-May-09 10:29 
I am working with csv files.

I started out using ADO to grab column and data, however there is a flaw in doing this.

I have data that is F3, F5, F{something} and Excel automatically tries to put the dataType as a Float.

I moved to opening the file using StreamReader and im able to successfully import an excel file into my application - but now I don't have the columns DataType.

Another bad thing about ADO I can't have is the 255 column limit, we will have datasets that contain over 300 columns if not more.

So what I ended up doing (just an fyi), is first collecting the List<string> of columns by using StreamReader reading the first line (headers) and placing them inside a List<string>

Now I iterate through the List<string> and use ADO to pull back that column name but empty -
(Select {columnName} from {XlsFile} Where 1=2)

I get back the column data and add it into a Dictionary<string,string> {'column', 'datatype'}

I now have my column Data that I need.

Now I have to go back through the csv file again using StreamReader

This time I am creating a DataTable with the columns and data inside it

Before I add the column I set the datatype to whatever the dataType is in the Dictionary<string,string> for that column Name.


Ok, this works good until I get data inside a column like 'F3'.

I know that Excel reads like 8-10 rows and tries to 'guess' what the dataType would be.
(any work arounds for this?)

Excel has already set this datatype to a 'float' or 'decimal' when it should of been 'string'

Ok, now my question(s)

1. Does this make sense?
2. Am I going to have to iterate through the data and if column's dataType is anything but String try to convert the data to the columns dataType and see if it's a match?

3. Any idea's on how I can get the correct dataTypes and columns without Interop or ADO?


Hope this makes sense, if not express it and I'll clarify.

Steve Welborn
Software Engineer
Eli Lilly
Indianapolis, Indiana.
AnswerRe: Need suggestion on getting column data from excel without using ADO or Excel Interops Pin
Dave Kreskowiak26-May-09 16:21
mveDave Kreskowiak26-May-09 16:21 
GeneralRe: Need suggestion on getting column data from excel without using ADO or Excel Interops Pin
DeepToot27-May-09 8:12
DeepToot27-May-09 8:12 
GeneralRe: Need suggestion on getting column data from excel without using ADO or Excel Interops Pin
Dave Kreskowiak27-May-09 12:01
mveDave Kreskowiak27-May-09 12:01 
QuestionTo Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Rajdeep.NET is BACK26-May-09 8:14
Rajdeep.NET is BACK26-May-09 8:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.