Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
AnswerRe: Digital clock for windows appliction Pin
crrajaguru5-Apr-09 23:01
crrajaguru5-Apr-09 23:01 
AnswerRe: Digital clock for windows appliction Pin
akhilonly0075-Apr-09 23:17
akhilonly0075-Apr-09 23:17 
GeneralRe: Digital clock for windows appliction Pin
Ch.Gayatri Subudhi6-Apr-09 18:03
Ch.Gayatri Subudhi6-Apr-09 18:03 
QuestionHow to generate specific barcodes like KOELLIKER, OMR4, NEOPOST B, OMR... Pin
tom5720075-Apr-09 22:40
tom5720075-Apr-09 22:40 
RantRe: How to generate specific barcodes like KOELLIKER, OMR4, NEOPOST B, OMR... Pin
tom5720076-Apr-09 5:31
tom5720076-Apr-09 5:31 
QuestionMultiple selection Pin
Megidolaon5-Apr-09 22:08
Megidolaon5-Apr-09 22:08 
AnswerRe: Multiple selection Pin
King Julien6-Apr-09 0:01
King Julien6-Apr-09 0:01 
QuestionHow to save file content that some contains same lines into the database? Pin
Nopo5-Apr-09 22:08
Nopo5-Apr-09 22:08 
Hi all,

Can you please help me out or advice on how to solve the following problem.

I'm reading files line by line from a folder and I'm saving the file content into the database. Now, my problem is that some of the lines from the file are the same. I can read the first line and when I reach the other line that has the same name as that first line my 'line' variable becomes empty and nothing got saved in the database (for only those lines that are the same). I need to save all the content of the file into the database, even those lines that are the same (numbering and heading).

my file looks like this (taken some content of the file)

1. This Report Concerns :
an individual

2. Surname :
Nkwanyana

3. First Name :
Nonti

4. Other Initials :
Z

5. Identifying number :
7200506586321

6. Type of Identifier :
_ID Book

7. Country of Residence :
South Africa

1. Transaction was conducted by :
the person referred to in Part D

2. Surname :
Phungo

3. First Name :
Hendrica

4. Other Initials :
M

5. Identifying number :
8695421345789

6. Type of Identifier :
ID book

7. Is there a photograph or other image of the person available?
NO

my code looks like:

if (line != null && line.Contains("2. Surname :"))
{
line = reader.ReadLine();
Surname = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("3. First Name :"))
{
line = reader.ReadLine();
FirstName = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("4. Other Initials :"))
{
line = reader.ReadLine();
OtherInitials = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("5. Identifying number :"))
{
line = reader.ReadLine();
IdentifyingNumber = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("6. Type of Identifier :"))
{
line = reader.ReadLine();
TypeOfIdentifier = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("7. Country of Residence :"))
{
line = reader.ReadLine();
CountryOfResidence = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("2. Surname :"))
{
line = reader.ReadLine();
SecSurname = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("3. First Name :"))
{
line = reader.ReadLine();
SecFirstName = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("4. Other Initials :"))
{
line = reader.ReadLine();
SecOtherInitials = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("5. Identifying number :"))
{
line = reader.ReadLine();
SecIdentifyingNumber = line;
line = reader.ReadLine();
}
if (line != null && line.Contains("6. Type of Identifier :"))
{
line = reader.ReadLine();
SecTypeOfIdentifier = line;
line = reader.ReadLine();
}

Will really appreciate your help.

Thanks.
AnswerRe: How to save file content that some contains same lines into the database? Pin
SeMartens5-Apr-09 22:20
SeMartens5-Apr-09 22:20 
GeneralRe: How to save file content that some contains same lines into the database? Pin
Nopo5-Apr-09 22:28
Nopo5-Apr-09 22:28 
GeneralRe: How to save file content that some contains same lines into the database? Pin
SeMartens5-Apr-09 22:42
SeMartens5-Apr-09 22:42 
GeneralRe: How to save file content that some contains same lines into the database? Pin
Nopo5-Apr-09 23:58
Nopo5-Apr-09 23:58 
GeneralRe: How to save file content that some contains same lines into the database? Pin
Nopo6-Apr-09 20:07
Nopo6-Apr-09 20:07 
QuestionHow to run any .exe file through WebService ? Pin
E_Gold5-Apr-09 22:07
E_Gold5-Apr-09 22:07 
AnswerRe: How to run any .exe file through WebService ? Pin
SeMartens5-Apr-09 22:10
SeMartens5-Apr-09 22:10 
GeneralRe: How to run any .exe file through WebService ? Pin
E_Gold6-Apr-09 2:29
E_Gold6-Apr-09 2:29 
GeneralRe: How to run any .exe file through WebService ? Pin
SeMartens6-Apr-09 2:49
SeMartens6-Apr-09 2:49 
QuestionCannot delete file....used by another process.....help guyz! Pin
Rajdeep.NET is BACK5-Apr-09 21:53
Rajdeep.NET is BACK5-Apr-09 21:53 
AnswerRe: Cannot delete file....used by another process.....help guyz! Pin
N a v a n e e t h5-Apr-09 22:06
N a v a n e e t h5-Apr-09 22:06 
AnswerRe: Cannot delete file....used by another process.....help guyz! Pin
SeMartens5-Apr-09 22:06
SeMartens5-Apr-09 22:06 
GeneralRe: Cannot delete file....used by another process.....help guyz! Pin
Rajdeep.NET is BACK5-Apr-09 22:14
Rajdeep.NET is BACK5-Apr-09 22:14 
GeneralRe: Cannot delete file....used by another process.....help guyz! Pin
HuntingWabbits6-Apr-09 2:29
HuntingWabbits6-Apr-09 2:29 
GeneralRe: Cannot delete file....used by another process.....help guyz! Pin
Skymir6-Apr-09 3:08
Skymir6-Apr-09 3:08 
AnswerRe: Cannot delete file....used by another process.....help guyz! Pin
Henry Minute6-Apr-09 1:52
Henry Minute6-Apr-09 1:52 
QuestionAbout Thread............ Pin
Isaac Gordon5-Apr-09 21:50
Isaac Gordon5-Apr-09 21:50 

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.