Hello,
I am using this code for export datagridview's data to pipe separated txt file.
StreamWriter sw = new StreamWriter(filePath, false);
int iColCount = dataTable.Columns.Count;
//for (int i = 0; i < iColCount; i++)
//{
// sw.Write(dataTable.Columns[i]);
// if (i < iColCount - 1)
// {
// sw.Write("|");
// }
//}
//sw.Write(sw.NewLine);
foreach (DataRow row in dataTable.Rows)
{
for (int i = 0; i < iColCount; i++)
{
if (!Convert.IsDBNull(row[i]))
{
sw.Write(row[i].ToString());
}
if (i < iColCount - 1)
{
sw.Write("|");
}
}
sw.Write(sw.NewLine);
}
sw.Close();
It's code running successfully, i mean to say, successfully exported in pipe separated file but when we update any value in it's export's file and then import same file in to the database using c# .net so,my database did not update from this file.
Please help me.
Thanks in Advance
Ankit Agarwal
Software Engineer