Click here to Skip to main content
15,894,630 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Ian McCaul26-May-09 8:26
Ian McCaul26-May-09 8:26 
AnswerRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak PinPopular
fly90426-May-09 8:46
fly90426-May-09 8:46 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Rajdeep.NET is BACK26-May-09 20:13
Rajdeep.NET is BACK26-May-09 20:13 
AnswerRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak PinPopular
Dave Kreskowiak26-May-09 9:11
mveDave Kreskowiak26-May-09 9:11 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Rajdeep.NET is BACK26-May-09 19:32
Rajdeep.NET is BACK26-May-09 19:32 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Dave Kreskowiak27-May-09 1:11
mveDave Kreskowiak27-May-09 1:11 
AnswerRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
EliottA26-May-09 10:11
EliottA26-May-09 10:11 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Rajdeep.NET is BACK26-May-09 19:42
Rajdeep.NET is BACK26-May-09 19:42 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Colin Angus Mackay26-May-09 21:05
Colin Angus Mackay26-May-09 21:05 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
EliottA27-May-09 2:50
EliottA27-May-09 2:50 
AnswerRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
0x3c026-May-09 10:39
0x3c026-May-09 10:39 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Rajdeep.NET is BACK26-May-09 20:08
Rajdeep.NET is BACK26-May-09 20:08 
GeneralRe: To Henry Minute, Original Griff, fly904, stancrm, Computafreak, Guffa, DaveyM69, J4amieC, Tom Deketelaere and Dave Kreskowiak Pin
Guffa26-May-09 10:40
Guffa26-May-09 10:40 

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.