OleDbConnection Mycon = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=MyDb.mdb");
FileStream fs = new FileStream(filename,FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] mywave = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
Mycon.Open();
string sql = "insert into MyDataBase(wav,MyWord) VALUES (@wav,'"+textBox1.Text.Trim()+"')";
OleDbCommand cmd = new OleDbCommand(sql, Mycon);
cmd.Parameters.Add("@wav", OleDbType.Binary, photo.Length).Value = mywave ;
cmd.ExecuteNonQuery();
Mycon.Close();
C# 怎样把二进制文件写入Access数据库
最新推荐文章于 2019-11-06 18:33:48 发布