下面代码是你的,我还是不懂,也不能运行,提示[color=FF0000]da.Fill(ds, "picture")[/color]有异常。帮帮忙吧。谢谢了。

Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Imports System.Drawing.Imaging
Public ds As New DataSet
    Public imagefilepath As String = ""

    Dim bm As BindingManagerBase
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim connstr As String = " provider=sqloledb;data source=(local); initial catalog=XSXX;trusted_connection=yes"
        Dim cn As New OleDbConnection(connstr)
        Dim cmd As New OleDbCommand("SELECT * FROM picture where photo='" & Me.Text.Substring(3) & "'", cn)
        Dim da As New OleDbDataAdapter(cmd)

        Dim ds As New DataSet
        da.Fill(ds, "picture")
        Dim fsBLOBFile As New FileStream(imagefilepath, FileMode.Open, FileAccess.Read)
        Dim c As Integer = ds.Tables("picture").Rows.Count
        Dim bytBLOBData(fsBLOBFile.Length() - 1) As Byte
        If c > 0 Then
            Dim stmBLOBData As New MemoryStream(bytBLOBData)
            PictureBox1.Image = Image.FromStream(stmBLOBData)
        End If
        bm = Me.BindingContext(ds, "picture")
        CheckBm()

    End Sub
    
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.OpenFileDialog1.InitialDirectory = Application.StartupPath
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            imagefilepath = OpenFileDialog1.FileName   '此时,路径已经返回到imagefilepath中去了
            PictureBox1.Image = Image.FromFile("c:\photo")
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim connstr As String = " provider=sqloledb;data source=(local); initial catalog=XSXX;trusted_connection=yes"
        Dim cn As New OleDbConnection(connstr)
        Dim insertcmd As String = "insert into picture values ( '" & Me.Text.Substring(3).Trim & "',@pic) "
        Dim cmd As OleDbCommand

        cmd = New OleDbCommand(insertcmd, cn)
        Dim da As New OleDbDataAdapter(cmd)
        Try
            Dim fsBLOBFile As New FileStream(imagefilepath, FileMode.Open, FileAccess.Read)
            Dim bytBLOBData(fsBLOBFile.Length() - 1) As Byte
            fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length)
            fsBLOBFile.Close()
            Dim prm As New OleDbParameter("@pic", SqlDbType.VarBinary, _
                bytBLOBData.Length, ParameterDirection.Input, False, _
                0, 0, Nothing, DataRowVersion.Current, bytBLOBData)
            cmd.Parameters.Add(prm)
            cn.Open()
            cmd.ExecuteNonQuery()
            cn.Close()
            MessageBox.Show("图片保存成功!!")
            ds.Clear()
            da.Fill(ds, "picture")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        CheckBm()

    End Sub