C# 怎样把二进制文件写入Access数据库

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();

你可能感兴趣的:(sql,C++,c,C#,Access)