krishnakumar kuna

krishnakumar kuna

  • NA
  • 57
  • 36.8k

Insert string from text file to database

Sep 28 2013 2:53 AM
hi,
     I have text file with data like this 

"first","second","third","fourth"
"first","second","third","fourth"
"first","second","third","fourth"
"first","second","third","fourth"
"first","second","third","fourth"

now i need to fetch these string to be inserted into database which is remote

if (File.Exists(fileName))
{
StreamReader sr = new StreamReader(fileName);
String line;
while ((line = sr.ReadLine()) != null)
{
if (line.Trim() != string.Empty)
{
//You will get Text Line in s.
s = line;


linetex = s.Split(',');
for (int i = 0; i <= linetex.Length - 1; i++)
{

item = linetex;
a.Text = item[2];
b.Text=item[13];
c.Text=item[17];

}
}
}


I need to insert these array items into database or is there any way i can store the string in list or enumerator or collection also helpfull.

thanks in advance