Click here to Skip to main content
15,919,931 members
Home / Discussions / C#
   

C#

 
QuestionTyping in DatagridviewComboboxColumn Pin
jojoba20113-Oct-10 3:47
jojoba20113-Oct-10 3:47 
AnswerSolved: Typing in DatagridviewComboboxColumn Pin
jojoba20113-Oct-10 4:51
jojoba20113-Oct-10 4:51 
AnswerRe: Typing in DatagridviewComboboxColumn Pin
Abhinav S3-Oct-10 4:59
Abhinav S3-Oct-10 4:59 
Questionf Pin
Sajid Maqbool2-Oct-10 23:34
Sajid Maqbool2-Oct-10 23:34 
AnswerRe: f PinPopular
OriginalGriff2-Oct-10 23:38
mveOriginalGriff2-Oct-10 23:38 
AnswerRe: f Pin
Nagy Vilmos3-Oct-10 3:40
professionalNagy Vilmos3-Oct-10 3:40 
AnswerRe: f Pin
#realJSOP4-Oct-10 2:05
professional#realJSOP4-Oct-10 2:05 
QuestionImporting .CSV Files To A SQL Database Pin
Roger Wright2-Oct-10 21:41
professionalRoger Wright2-Oct-10 21:41 
I've spent the last two evenings writing a routine to import .csv files to a SQL Server database - not that I'm anywhere near to done yet... So far I've got a parser that can read multiple files selected from an OpenFileDialog, and strip most of the crap out of them, then appending the records to a file that will be used for later import into a dataset and INSERTed to a SQL Server DB. But there's a sticky bit I'd like some advice about...

Every day I receive power meter readings from our supplier, the Western Area Power Administration (WAPA), that give me the power received from them through several meters, broken down by hourly brackets. Each transmission (via email) includes header lines that can contain anything at all, but thankfully cannot be parsed by the Split() method. My program, so far, strips all of them out. There's also a final line that tells me how many records are included, which I also ignore. But there's also a record that yields the total from all meters which I don't want to include. The mystery here is that, when I use the Split() method on a line I've read from the file, the array returned seems to be 1-based, not 0-based. I can clearly see in Notepad that the first field returned is a date value, but accessing that date requires using Split[1]. I can tell, for instance, that the beginning of real data has been reached by testing Split[1] for a valid date. I ignore everything before that discovery. The totals line that I want to ignore also contains a valid date in the Split[1] field, followed by a blank space in the next field. I tried skipping lines that have a blank space in the second field, Split[2], but that didn't work.

What I'm thinking is that, since I do have all the relevant data sent to a file with proper delimiters, maybe it would be better to just import what I have to SQL Server and let a query sort out the rows with missing fields. Whatcha think?
Will Rogers never met me.

AnswerRe: Importing .CSV Files To A SQL Database Pin
dan!sh 2-Oct-10 23:14
professional dan!sh 2-Oct-10 23:14 
AnswerRe: Importing .CSV Files To A SQL Database Pin
Luc Pattyn3-Oct-10 2:51
sitebuilderLuc Pattyn3-Oct-10 2:51 
GeneralRe: Importing .CSV Files To A SQL Database Pin
Roger Wright4-Oct-10 20:04
professionalRoger Wright4-Oct-10 20:04 
GeneralRe: Importing .CSV Files To A SQL Database Pin
Luc Pattyn5-Oct-10 1:55
sitebuilderLuc Pattyn5-Oct-10 1:55 
AnswerRe: Importing .CSV Files To A SQL Database Pin
PIEBALDconsult3-Oct-10 3:49
mvePIEBALDconsult3-Oct-10 3:49 
QuestionForeach Pin
Saksida Bojan2-Oct-10 6:29
Saksida Bojan2-Oct-10 6:29 
AnswerRe: Foreach Pin
Abhinav S2-Oct-10 6:44
Abhinav S2-Oct-10 6:44 
GeneralRe: Foreach Pin
Saksida Bojan2-Oct-10 6:54
Saksida Bojan2-Oct-10 6:54 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 6:59
sitebuilderLuc Pattyn2-Oct-10 6:59 
GeneralRe: Foreach Pin
Saksida Bojan2-Oct-10 7:06
Saksida Bojan2-Oct-10 7:06 
AnswerRe: Foreach Pin
Luc Pattyn2-Oct-10 6:57
sitebuilderLuc Pattyn2-Oct-10 6:57 
GeneralRe: Foreach Pin
Saksida Bojan2-Oct-10 7:13
Saksida Bojan2-Oct-10 7:13 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:38
sitebuilderLuc Pattyn2-Oct-10 7:38 
AnswerRe: Foreach Pin
Henry Minute2-Oct-10 7:05
Henry Minute2-Oct-10 7:05 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:35
sitebuilderLuc Pattyn2-Oct-10 7:35 
GeneralRe: Foreach Pin
Henry Minute2-Oct-10 7:44
Henry Minute2-Oct-10 7:44 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:45
sitebuilderLuc Pattyn2-Oct-10 7:45 

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.