2 Replies - 2742 Views - Last Post: 10 October 2012 - 06:14 AM Rate Topic: -----

#1 kampao00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 29-March 12

ERROR : Cannot find table 0.

Posted 10 October 2012 - 05:36 AM

i had a problem with this codes.. this codes will retrieve image from database that will based on the employeenumber.

Dim CN As New OleDbConnection(cnString)
        CN.Open()
        daImage = New OleDbDataAdapter()
        daImage.SelectCommand = New OleDbCommand("SELECT EmployeeNumber , IDPictureLocation FROM EmployeeProfile where       EmployeeNumber = '" & EmployeeNumberIDTB.Text & "'", CN)
        dsImage = New DataSet("dsImage")

        Dim dataTable As DataTable = dsImage.Tables(0)

        If IDPicturePB.Image IsNot Nothing Then

            IDPicturePB.Image.Dispose()
        End If

        Dim fsImage As New FileStream("image.jpg", FileMode.Create)

        For Each dataRow As DataRow In dataTable.Rows
            If dataRow(0).ToString() = EmployeeNumberIDTB.Text.ToString() Then

                Dim blob As Byte() = DirectCast(dataRow(1), Byte())

                fsImage.Write(blob, 0, blob.Length)
                fsImage.Close()
                fsImage = Nothing

                IDPicturePB.Image = Image.FromFile("image.jpg")
                IDPicturePB.SizeMode = PictureBoxSizeMode.StretchImage
                IDPicturePB.Refresh()
            End If
        Next



error in this line : Dim dataTable As DataTable = dsImage.Tables(0)
can someone explain it to me? :(
error is Cannot find table 0.

Is This A Good Question/Topic? 0
  • +

Replies To: ERROR : Cannot find table 0.

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,200
  • Joined: 25-September 09

Re: ERROR : Cannot find table 0.

Posted 10 October 2012 - 06:05 AM

I don't see where you're filling your dataset from the dataadapter.
Was This Post Helpful? 0
  • +
  • -

#3 kampao00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 29-March 12

Re: ERROR : Cannot find table 0.

Posted 10 October 2012 - 06:14 AM

i just want to retrieve the image from the table. how to do it right? can someone help me? :3
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1