需要将binay[]转换成bitmap格式,具体转换你可以在搜索里搜一下即可有答案,以前问得比较多的。

解决方案 »

  1.   

    给一个参考:http://www.yesky.com/20030311/1656281.shtml
      

  2.   

    private void button5_Click(object sender, System.EventArgs e)
    {
    byte[] s;
    int cd;
                    string conn=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=biao.mdb";
                    OleDbCommand oc;
            OleDbConnection nt;
                    nt =new OleDbConnection(conn);
    nt.Open();
    oc=new OleDbCommand("insert into biao (name,pass,tp)values('s','d',@tp)",nt);
    if(openFileDialog1.ShowDialog()==DialogResult.OK)
    {
                        FileStream fs=new FileStream(this.openFileDialog1.FileName,FileMode.Open,FileAccess.Read);
        cd=(int)fs.Length;
        s=new byte[cd];
    fs.Read(s,0,cd);
    Bitmap mp=new Bitmap(this.openFileDialog1.FileName);
    this.pictureBox1.Image=mp;
        oc.Parameters.Add("@tp",OleDbType.VarBinary ,cd);
    oc.Parameters["@tp"].Value=s;
    oc.ExecuteNonQuery();
    }
    //pictureBox1怎么绑定呀,我点到某条记录,pictureBox1就显示图呀。