Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I've faced the big problem here where I use an array to store temporary data that I grab from textfile. However, some of the data contains of special characters e.g. "" or @

Full example: SPECIAL "FORCE" ARMY

How may I include the "" characters to array?
Posted

1 solution

I don't see that it should be a problem: just read the file into an array:
VB
Dim data As Byte() = File.ReadAllBytes("d:\Temp\MyTextFile.txt")


If you aren't doing this, what are you doing?
 
Share this answer
 
Comments
Luiey Ichigo 3-Jan-12 20:12pm    
Currently there are a lot of data in it such as name, address, phone number and annual fee for membership..this data contains at least 8000 line in text file a.k.a notepad. The data is listed as line by line. Some of the data contain the special character as I ask question above. So I need some guide to handle this because it got error when it reach to data that contains special char. I'm not sure whether I suppose to include the special char but handle the events OR get rid of special char (check for special char and remove it)..please help me.
Luiey Ichigo 3-Jan-12 20:14pm    
Addition: I use command to upload the data into database from text file..
OriginalGriff 4-Jan-12 3:37am    
AH! Theres your problem.
And I just bet you are doing it by concatenating your data into a command string?
Don't. Use a Parametrized query instead - you problem will disappear, as if by magic - and your database will be resistant to SQL Injection attack, as well.
If you aren't sure how, show me the code fragment that you use to insert to the database, and I will show you how to convert it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900