i have stored the txt file to sql server database . i need to read the txt file line by line to get the content in it. my code :
DataTable dtDeleteFolderFile = new DataTable();
dtDeleteFolderFile = objutility.GetData("GetTxtFileonFileName", new object[] { ddlSelectFile.SelectedItem.Text }).Tables[0];
foreach (DataRow dr in dtDeleteFolderFile.Rows)
{
name = dr["FileName"].ToString();
records = Convert.ToInt32(dr["NoOfRecords"].ToString());
bytes = (Byte[])dr["Data"];
}
FileStream readfile = new FileStream(Server.MapPath("txtfiles/" + name), FileMode.Open);
StreamReader streamreader = new StreamReader(readfile);
string line = "";
line = streamreader.ReadLine();
but here i have used the FileStream
to read from the Particular path. but i have saved the txt file in byte format into my Database. how to read the txt file using the byte[] value to get the txt file content, instead of using the Path value.