小白有问题:如何将图片路径写入access  多谢了 
Partial Class Default3
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If IsPostBack Then
            Dim path As String = Server.MapPath("~/UploadedImages/")
            Dim fileOK As Boolean = False
            If FileUpload1.HasFile Then
                Dim fileExtension As String
                fileExtension = System.IO.Path. _
                    GetExtension(FileUpload1.FileName).ToLower()
                Dim allowedExtensions As String() = _
                    {".jpg", ".jpeg", ".png", ".gif"}
                For i As Integer = 0 To allowedExtensions.Length - 1
                    If fileExtension = allowedExtensions(i) Then
                        fileOK = True
                    End If
                Next
                If fileOK Then
                    Try
                        FileUpload1.PostedFile.SaveAs(path & _
                             FileUpload1.FileName)
                        Label1.Text = "File uploaded!"
                        
                    Catch ex As Exception
                        Label1.Text = "File could not be uploaded."
                    End Try
                Else
                    Label1.Text = "Cannot accept files of this type."
                End If
            End If
        End If
    End Sub

解决方案 »

  1.   

    图片路径写入access 这其实就是很简单的一件事  路径就是字符形态, 只要你指定的字段字段长度够,指定那一笔数据后
    rs1.fields(?)="图片所在的全路径包含文件名称与扩展名" 
    rs1.update这样就可以啦,如果字段长度不够肯定将报错,记住路径如果包含汉字的话,一个汉字占两个字符的长度。要节省空间的话 文件夹路径固定下来,数据库只要保存文件名称带扩展名即可。