【发布时间】:2015-01-22 09:55:57
【问题描述】:
[错误] 空路径名不合法 问题是我无法将图像插入 Access 数据库。哪一行是错误的。在此先感谢帮助我的人
问候, 菲祖尔
Dim OpenFileDialog1 As New OpenFileDialog
Dim fsreader As New IO.FileStream(OpenFileDialog1.FileName,IO.FileMode.Open, IO.FileAccess.Read)
Dim breader As New IO.BinaryReader(fsreader)
Dim imgbuffer(fsreader.Length) As Byte
breader.Read(imgbuffer, 0, fsreader.Length)
fsreader.Close()
cnn.ConnectionString = "provider=microsoft.ace.oledb.12.0; data source = |datadirectory|\db1.accdb;"
cnn.Open()
Dim sql As String
sql = "insert into Table1 Values(" & TextBox1.Text & ",'" & imgbuffer.Length & "')"
Dim cmd As New OleDb.OleDbCommand(sql, cnn)
cmd.ExecuteNonQuery()
cmd.Dispose()
cnn.Close()
【问题讨论】: