0

hello I want to save and retrieval a picture from access database and i have this code that i use it in my work but when i use it they tell me that the table that i look for does not exist and i used visual basic .net 2010 .please help me

 Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If Trim(txtFileName.Text) = "" Then Exit Sub
        Dim br As New IO.BinaryReader(New IO.FileStream(txtFileName.Text, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read))
        Dim arr() As Byte = br.ReadBytes(br.BaseStream.Length)
        Dim dt As DataTable = ds.Tables(0)
        Dim row As DataRow = dt.NewRow
        row.Item(0) = arr
        row.Item(1) = TextBox1.Text
        dt.Rows.Add(row)
        ds.Tables.Clear()
        ds.Tables.Add(dt)
        da.Update(ds)
        MsgBox("Image added successfully!!", MsgBoxStyle.Information)
    End Sub
2
Contributors
1
Reply
6
Views
2 Years
Discussion Span
Last Post by Shark_1
0

Before updatation how could you clear the table name from the data source. Your problem is in line no 10. Don't clear tables name before updatation. If you clear before, how could data-adapter perform update?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.