Hi Developers,
I have one text file that contains data in a below format
00123456^USA^23:00:01^999^Peter
00646365^England^10:00:04^785^Samuel
8r885777^Australia^12:01:32^123^Romansh
Thanks in Advance
Hi Developers,
I have one text file that contains data in a below format
00123456^USA^23:00:01^999^Peter
00646365^England^10:00:04^785^Samuel
8r885777^Australia^12:01:32^123^Romansh
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
HoneyPosted Jul 16, 2010, 8:34 AM
Try this..
//declaring streamreader to read text file
StreamReader objReader = new StreamReader(filepath);
string sLine = "";
int i = 1;
//checking if the text file is empty or not
while (sLine != null)
{
//reading the line from text file and stored into a string variable
sLine = objReader.ReadLine();
//checking the line stored string varible is empty or not if it it not empty storing the value into dropdownlist
if (sLine != null)
{
//data will be available in the string array named as "s"
string[] s = sLine.Split('^');
//insert statement of data base
}
}
objReader.Close();