stream = System.IO.File.ReadAllBytes("E:\sogam.wav")
str = "INSERT INTO reg (Name,ContentType,Data)VALUES(@Name,@ContentType,@Data)"
Try
cmd = New OleDbCommand(str, dbcon)
cmd.Parameters.Add("@Name", OleDbType.Char, 20).Value = "hope1"
cmd.Parameters.Add("@ContentType", OleDbType.Char, 20).Value = "audio"
cmd.Parameters.Add("@Data", OleDbType.Binary, 30).Value = stream
cmd.ExecuteNonQuery()
MsgBox("inserted")
Catch ex As Exception
MsgBox("not working")
End Try
以上就是我的代码,它将.wav文件插入数据库中(而Data是二进制数据类型) 任何人都可以说如何检索音频文件
答案 0 :(得分:0)
很简单:
SELECT
Data
FROM reg r
WHERE
r.ContentType = 'audio
and r.Name = 'hope1'