网上找到的一个保存数数到access的例子

呵呵,我这有现成的,c#+access的: private void load() { OleDbConnection conn=new OleDbConnectio(Common.ComClass.ComClass.GetConnStr()); OleDbCommand cmd=new OleDbCommand("select top 1 * from 签名",conn); OleDbDataReader dr; conn.Open(); dr=cmd.ExecuteReader(); if(dr.Read()) { Byte[] byteBLOBData = new Byte[0]; byteBLOBData = (Byte[])dr.GetValue(0); MemoryStream stmBLOBData = new MemoryStream(byteBLOBData); s1.Image=Image.FromStream(stmBLOBData); byteBLOBData = (Byte[])dr.GetValue(1); stmBLOBData = new MemoryStream(byteBLOBData); s2.Image=Image.FromStream(stmBLOBData); } dr.Close(); conn.Close(); } private void button3_Click(object sender, System.EventArgs e) { if(str1==null) return; OleDbConnection conn=new OleDbConnection(Common.ComClass.ComClass.GetConnStr()); OleDbCommand cmd=new OleDbCommand("update 签名 set 负责人=@Image",conn); string strBLOBFilePath=str1; FileStream fsBLOBFile = new FileStream(strBLOBFilePath,FileMode.Open, FileAccess.Read); Byte[] bytBLOBData = new Byte[fsBLOBFile.Length]; fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length); fsBLOBFile.Close(); OleDbParameter prm=new OleDbParameter("@Image",OleDbType.Binary,bytBLOBData.Length, ParameterDirection.Input,false,0,0,null,DataRowVersion.Current,bytBLOBData); cmd.Parameters.Add(prm); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); ComClass.Msg("成功保存技术负责人签名!"); } 自已修改一下。

网上找到的一个保存数数到access的例子

上一篇:解决HP服务器安装Centos7 x64无法识别硬盘


下一篇:MySQL事务