I'm trying to retrieve the varbinary
array of values from SQL Server than trying to store them in a text file which the user can download but not sure how to return the file back to Response.Redirect()
or how to return the text file.
public byte[] GenerateTextFile()
{
if (m_Template == CFCTemplate.GETTXTDATA)
{
SqlCommand cmd = new SqlCommand("SELECT SpecData FROM Spec WHERE TestID=" + SpecTestID);
InternalSalesDB.Instance.query(cmd);
DataTable dt = InternalSalesDB.Instance.query(cmd).Tables[0];
if (dt.Rows.Count > 0)
{
byte[] binarySpec = (byte[])dt.Rows[0][0];
FileStream fileStream = new FileStream("TestData.txt",FileMode.Append);
fileStream.Write(binarySpec, 0, binarySpec.Length);
fileStream.Flush();
fileStream.Close();
}
}
//need return statement here ??
}