Visual Studio 2005 in connection w/ MS Access 2003, Inventory System

Unanswered Visual Studio 2005 in connection w/ MS Access 2003, Inventory System

  • Thursday, August 09, 2012 3:22 AM
     
     

    Hi fellow programmers. Im a student from the Philippines and I need your help. I am currently doing an inventory system using Visual Studio 2005 and Access 2003. I have an add, edit, delete button. The add button works which add the data im entering to the database but i cant seem to edit. There seems to be an error in the "da.Fill(dt)" HELP! whats wrong? im facing a deadline or im dead. THANKS! heres the code in the edit button. (Maybe its my syntax?)

    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
            If Me.dgv.Rows.Count > 0 Then
                If Me.dgv.SelectedRows.Count > 0 Then
                    Dim intCompNo As String = Me.dgv.SelectedRows(0).Cells("Company Item No").Value

                    If Not con.State = ConnectionState.Open Then
                        con.Open()

                    End If
                    Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Parts " & _
                        " WHERE compNo=" & intCompNo, con)
                    Dim dt As New DataTable
                    da.Fill(dt)

                    Me.compNo.Text = intCompNo
                    Me.manuNo.Text = dt.Rows(0).Item("manuNo")
                    Me.descr.Text = dt.Rows(0).Item("descr")
                    Me.quantity.Text = dt.Rows(0).Item("quantity")
                    Me.dolu.Value = dt.Rows(0).Item("dolu")
                    Me.tolu.Value = dt.Rows(0).Item("tolu")
                    Me.dolp.Value = dt.Rows(0).Item("dolp")
                    Me.polp.Text = dt.Rows(0).Item("polp")
                    Me.solp.Text = dt.Rows(0).Item("solp")
                    Me.rr.Text = dt.Rows(0).Item("rr")
                    Me.drs.Text = dt.Rows(0).Item("drs")
                    Me.drm.Text = dt.Rows(0).Item("drm")
                    Me.issueNo.Text = dt.Rows(0).Item("issueNo")

                    Me.compNo.Tag = intCompNo
                    Me.btnAdd.Text = "Update"

                    Me.btnEdit.Enabled = False
                    con.Close()


                End If
            End If
        End Sub

All Replies