且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将音频/视频转换为二进制,反之亦然

更新时间:2022-12-07 17:41:21

计算机上存储的所有文件都是二进制文件.因此,我认为您可能需要编辑您的问题,以使您想做的事情更清楚.
All files stored on a computer are binary. So I think that you might need to edit your question to make it clearer what it is that you want to do.


看看这个:

MSDN杂志 [
Take a look at this:

MSDN Magazine[^]


Dim sql As String =" INSERT INTO student VALUES(@Photo )"
昏暗的cmd作为新的SqlCommand(Sql,con)
昏暗的毫秒作为新的MemoryStream()
PictureBox1.Image.Save(ms,PictureBox1.Image.RawFormat)
昏暗的数据为Byte()= ms.GetBuffer()
将Dim p设置为新的SqlParameter("@ photo",SqlDbType.Image)
p.Value =数据
cmd.Parameters.Add(p)
cmd.ExecuteNonQuery()
MessageBox.Show(记录已保存",保存",MessageBoxButtons.OK)

我也将搜索将视频转换为字节的视频.但我有您想知道的解决方案之一.它仅在图像文件上.您将数据类型设置为图像".
Dim sql As String = "INSERT INTO student VALUES(@Photo)"
Dim cmd As New SqlCommand(Sql, con)
Dim ms As New MemoryStream()
PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
Dim data As Byte() = ms.GetBuffer()
Dim p As New SqlParameter("@photo", SqlDbType.Image)
p.Value = data
cmd.Parameters.Add(p)
cmd.ExecuteNonQuery()
MessageBox.Show("record has been saved", "Save", MessageBoxButtons.OK)

i will searching too for the video converting to byte. but i have one of the solution you want to know. it only on the image file. you will set your data type to "image".