i am trying to get files as bytes from table and show , i am getting the files as dataset but when trying to move it as datatable it shows row as zero and moves out of the if condition
protected void btnview_Click(object sender, EventArgs e)
{
string code = txtbudid.Text;
try
{
{
using (MasterManagement mMgmt = new MasterManagement(General.ConnString()))
{
dsBud = mMgmt.getfile(code);
DataTable dt = new DataTable();
dsBud.Tables.Add(dt);
if (dsBud != null)
{
if (dt.Rows.Count > 0)
{
byte[] bytes = (byte[])dt.Rows[0]["filedata"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.ContentType = dt.Rows[]
Response.AddHeader("Content-disposition", "attachment;filename=" + dt.Rows[0]["filename"].ToString());
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
}
}
}