Read from a textfile and save in database

Z

zPaul

The logic is you read a line and chop it out according to the position of
each type of data. For LDCustomer, you will get substring of 0 to 4 etc..
 
G

Gilad Goldberg

I would use StringReader to read the line, not substring. Cleaner, i
believe.

zPaul said:
The logic is you read a line and chop it out according to the position of
each type of data. For LDCustomer, you will get substring of 0 to 4 etc..
 
L

Lasse Edsvik

are you using access or sql server?

if sql server you can do a bulk insert with bcp

/Lasse
 
F

[ F e r n a n d o L o p e s ]

Sorry about the date man.
I change to test some functions in one program and forgot.
 
F

[ F e r n a n d o L o p e s ]

Well, ok but, how can I do the loop.
I need help to write the logical code for get the data from de .txt file and
insert into the database
Is something like this?

StreamReader file = new StreamReader("C:\\data.txt");
for (int i=0;i<file.Lenght;i++)
{
Here i don´t know what am i do!!
}

Thanks.

Fernando Lopes


zPaul said:
The logic is you read a line and chop it out according to the position of
each type of data. For LDCustomer, you will get substring of 0 to 4 etc..
 
F

[ F e r n a n d o L o p e s ]

Hello Lasse.
Sorry but, what is a bulk insert with bcp?

Thanks

Fernando Lopes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top