Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
AnswerRe: Compress and extract a folder Pin
12Code6-Apr-09 21:59
12Code6-Apr-09 21:59 
AnswerRe: Compress and extract a folder Pin
Vasudevan Deepak Kumar6-Apr-09 23:34
Vasudevan Deepak Kumar6-Apr-09 23:34 
AnswerRe: Compress and extract a folder Pin
Laddie7-Apr-09 0:58
Laddie7-Apr-09 0:58 
QuestionOracleClient.OracleException ORA-06550 with anonymous block taking no argument [modified] Pin
devvvy6-Apr-09 21:35
devvvy6-Apr-09 21:35 
AnswerRe: OracleClient.OracleException ORA-06550 with anonymous block taking no argument Pin
devvvy7-Apr-09 0:57
devvvy7-Apr-09 0:57 
QuestionCheckedListBox Pin
mrithula86-Apr-09 21:07
mrithula86-Apr-09 21:07 
AnswerRe: CheckedListBox Pin
Henry Minute7-Apr-09 1:29
Henry Minute7-Apr-09 1:29 
QuestionHow to read multiple lines from a file and save them into one variable (to be saved into the DB) Pin
Nopo6-Apr-09 21:01
Nopo6-Apr-09 21:01 
Hi all,

I'm reading files from a certain folder and save everything into the database. I have a problem of reading multiple lines for a certain heading in a file and save them into one variable (to be saved into the database later).

e.g File content looks like this:

1. Date of Transaction :
20030728

2. Type of funds :
_Cash

3. Amount of Transaction(s) in Rand Value:
13500.00

4. Currency :
ZAR

PART H: List of available documents
Deal slip
Moneygram form
Copy of ID
BOP form
Gift declaration

I'm reading each line and save the value into a variable to be saved in the databse. e.g:

while ((line = reader.ReadLine()) != null)
{
if (line != null && line.Contains("1. Date of transaction :"))
{
line = reader.ReadLine();
DateOfTransaction = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("2. Type of funds :"))
{
line = reader.ReadLine();
TypeOfFunds = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("3. Amount of Transaction(s) in Rand Value:"))
{
line = reader.ReadLine();
AmountOfTransaction = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("4. Currency :"))
{
line = reader.ReadLine();
Currency = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("PART H: List of available documents :"))
{
line = reader.ReadLine();
PartHListOfAvailableDocs = line;
line = reader.ReadLine();
}
}

Heading (PART H: List of available documents) from the file is having multiple lines underneath it. How do I read each line and save them all in variable 'PartHListOfAvailableDocs'.

I'd really appreciate your help in this regard.

Thanks.
AnswerRe: How to read multiple lines from a file and save them into one variable (to be saved into the DB) Pin
Luc Pattyn7-Apr-09 4:13
sitebuilderLuc Pattyn7-Apr-09 4:13 
QuestionAccessing control from multiple forms Pin
mrithula86-Apr-09 20:50
mrithula86-Apr-09 20:50 
AnswerRe: Accessing control from multiple forms Pin
Christian Graus6-Apr-09 21:40
protectorChristian Graus6-Apr-09 21:40 
QuestionAbstract And Interface Pin
Isaac Gordon6-Apr-09 20:46
Isaac Gordon6-Apr-09 20:46 
AnswerRe: Abstract And Interface Pin
Vikram A Punathambekar6-Apr-09 21:29
Vikram A Punathambekar6-Apr-09 21:29 
AnswerRe: Abstract And Interface Pin
Mbah Dhaim6-Apr-09 21:41
Mbah Dhaim6-Apr-09 21:41 
AnswerRe: Abstract And Interface Pin
DaveyM696-Apr-09 22:46
professionalDaveyM696-Apr-09 22:46 
QuestionNeed help Licensed Windows Forms Controls in Internet Explorer Pin
Member 47160876-Apr-09 20:34
Member 47160876-Apr-09 20:34 
AnswerRe: Need help Licensed Windows Forms Controls in Internet Explorer Pin
Member 47160877-Apr-09 14:14
Member 47160877-Apr-09 14:14 
Questionexcel to listbox Pin
mist_psycho6-Apr-09 20:19
mist_psycho6-Apr-09 20:19 
AnswerRe: excel to listbox Pin
Christian Graus6-Apr-09 20:24
protectorChristian Graus6-Apr-09 20:24 
GeneralRe: excel to listbox Pin
mist_psycho6-Apr-09 20:30
mist_psycho6-Apr-09 20:30 
GeneralRe: excel to listbox Pin
Christian Graus6-Apr-09 21:42
protectorChristian Graus6-Apr-09 21:42 
AnswerRe: excel to listbox Pin
Giorgi Dalakishvili6-Apr-09 20:31
mentorGiorgi Dalakishvili6-Apr-09 20:31 
GeneralRe: excel to listbox Pin
mist_psycho6-Apr-09 20:34
mist_psycho6-Apr-09 20:34 
GeneralRe: excel to listbox Pin
Christian Graus6-Apr-09 21:43
protectorChristian Graus6-Apr-09 21:43 
AnswerRe: excel to listbox Pin
Laddie7-Apr-09 1:00
Laddie7-Apr-09 1:00 

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.