Click here to Skip to main content
15,167,809 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do I populate child elements in XML? Pin
Jegan Thiyagesan27-Feb-13 5:31
MemberJegan Thiyagesan27-Feb-13 5:31 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 5:38
MemberMagela27-Feb-13 5:38 
QuestionOffice Development problems Pin
Daytona67526-Feb-13 12:32
MemberDaytona67526-Feb-13 12:32 
AnswerRe: Office Development problems Pin
Matt T Heffron26-Feb-13 12:58
professionalMatt T Heffron26-Feb-13 12:58 
AnswerRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 6:04
MemberJegan Thiyagesan27-Feb-13 6:04 
GeneralRe: Office Development problems Pin
Matt T Heffron27-Feb-13 10:32
professionalMatt T Heffron27-Feb-13 10:32 
GeneralRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 12:57
MemberJegan Thiyagesan27-Feb-13 12:57 
QuestionTab Delimited file to sql database Pin
gavindon26-Feb-13 11:03
Membergavindon26-Feb-13 11:03 
ok, I have most of this worked out, but do have one problem.
I have a tab delimited text file that I am reading out into a datatable in the code, then pushing that to a stored proc on sql server. That part works but here is the problem.

This file has 15 columns in it. The following code is putting EACH line into the datatable 15 times.....

C#
using (StreamReader file = new StreamReader(@"C:\ProductionLog.txt"))
           {
               while ((line = file.ReadLine()) != null)
               {

                   char[] delimiters = new char[] { '\t' };
                   string[] rows = line.Split(delimiters, StringSplitOptions.None);

                   for (int i = 0; i < rows.Length; i++)
                   {
                       dt.Rows.Add(rows);
                   }//end for
                }//end while
                file.Close();
           }//end using streamreader


so I am getting,

BUNDLE	01/29/13	01:42 pm	7	5" 7'	63	5	84	1	6	17.31	31.155	16	0	0
BUNDLE	01/29/13	01:42 pm	7	5" 7'	63	5	84	1	6	17.31	31.155	16	0	0
BUNDLE	01/29/13	01:42 pm	7	5" 7'	63	5	84	1	6	17.31	31.155	16	0	0


15 times( it will do line 2 after it does the 15 and does it 15 times as well), instead of

CSS
BUNDLE	01/29/13	01:42 pm	7	5" 7'	63	5	84	1	6	17.31	31.155	16	0	0
BUNDLE	01/29/13	01:43 pm	7	5" 7'	64	5	84	1	6	16.96	54.262	9	1	2
BUNDLE	01/29/13	01:44 pm	7	5" 7'	65	5	84	1	6	17.56	33.712	15	4	0



and so on.




Can somebody tell me how much of a dumn** I am being and how to fix this?
Treat stressful situations like a dog, if you can't eat it, play with it or screw it, then just piss on it and walk away.

Be careful which toes you step on today, they might be connected to the foot that kicks your butt tomorrow.

AnswerRe: Tab Delimited file to sql database Pin
Matt T Heffron26-Feb-13 11:27
professionalMatt T Heffron26-Feb-13 11:27 
GeneralRe: Tab Delimited file to sql database Pin
gavindon26-Feb-13 12:25
Membergavindon26-Feb-13 12:25 
QuestionListbox colours. Pin
Septimus Hedgehog26-Feb-13 8:35
MemberSeptimus Hedgehog26-Feb-13 8:35 
AnswerRe: Listbox colours. Pin
Alan N26-Feb-13 9:40
MemberAlan N26-Feb-13 9:40 
AnswerRe: Listbox colours. Pin
Dave Kreskowiak26-Feb-13 10:05
mveDave Kreskowiak26-Feb-13 10:05 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog26-Feb-13 23:59
MemberSeptimus Hedgehog26-Feb-13 23:59 
GeneralRe: Listbox colours. Pin
Dave Kreskowiak27-Feb-13 2:01
mveDave Kreskowiak27-Feb-13 2:01 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog27-Feb-13 6:39
MemberSeptimus Hedgehog27-Feb-13 6:39 
Questioncan floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:01
Membernotahack26-Feb-13 7:01 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 7:15
mveRichard Deeming26-Feb-13 7:15 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard MacCutchan26-Feb-13 7:26
mveRichard MacCutchan26-Feb-13 7:26 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:35
Membernotahack26-Feb-13 7:35 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 8:39
mveRichard Deeming26-Feb-13 8:39 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 8:44
Membernotahack26-Feb-13 8:44 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 9:03
mveRichard Deeming26-Feb-13 9:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 9:13
Membernotahack26-Feb-13 9:13 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 10:03
mveDave Kreskowiak26-Feb-13 10:03 

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.