在我在可能的代码中出现错误之前,我从不使用 Bytes 请看一下
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
SqlDataReader dr = ExecuteReader(Globals.con, CommandType.Text,
"select FileName,MediaData,Extension from media where Id=" + ID);
string FileName="";
Byte[] MediaData= null;
string Extension = "";
while (dr.Read())
{
FileName = dr["FileName"].ToString();
MediaData = Convert.ToByte(dr["MediaData"].ToString()); error is here
Extension = dr["Extension"].ToString();
}
dr.Close();
string filename = (String)FileName;
byte[] fileToDownload = (byte[])MediaData;
String fileExtension = (String)Extension;
in gridview i use this code below it working i need manual date
not like code below
string filename = (String)reader.GetValue(1);
byte[] fileToDownload = (byte[])reader.GetValue(2);
String fileExtension = (String)reader.GetValue(3);
请帮帮我