我用
string constring = "......";
OleDbConnection con = new OleDbConnection(constring);
con.Open();string strsql = "select 图片 from 图片表 where 图片编号 = '01'";
OleDbCommand cmd = new OleDbCommand(strsql,con);
byte[] b = (byte[])cmd.ExecuteScaler();为什么不行啊请高手给个正解.

解决方案 »

  1.   

    byte b = byte.Parse(cmd.ExecuteScaler());
      

  2.   

    byte b = byte.Parse(cmd.ExecuteScalar().ToString());
      

  3.   

    public string ShowFiles(string sId)
    {
    DataSet fResult=null;
    string sFilePathName="";
    byte[] bFile;
    string sSQL="Select * From WSDA_B Where ID=@ID";

    OleDbParameter[] parameters = 
    {
    new OleDbParameter("@ID",OleDbType.Integer),
    };
        
    //设置参数值
    //用户名称
    parameters[0].Value = sId;
    fResult=ExecuteProcDs(sSQL,parameters); 

    if (fResult.Tables.Count>0)
    {
    if (fResult.Tables[0].Rows.Count>0)
    {
    sFilePathName=Application.StartupPath + @"\Tmp\"+ fResult.Tables[0].Rows[0]["WJMC"].ToString();
    System.IO.FileStream oFile = new System.IO.FileStream(sFilePathName, System.IO.FileMode.Create);
    bFile = (byte[])fResult.Tables[0].Rows[0]["DANR"];
    oFile.Write(bFile, 0, bFile.Length);
    oFile.Flush();
    oFile.Close();
    }
    }
    return sFilePathName;
    }
    难道不可以吗?我用的就是这个?
      

  4.   

    rightsea79 (sea) ,你读出的是个二进制流--属于读文件呀,要想楼上这种方法