Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

VS 2008 Updating Record Question

$
0
0
Ok I have a query returning 1 single Row Always a Single row of data.
when I move the data from the dataset I do it this way.
Code:

Try
            dbProvider = "provider=Microsoft.ACE.OLEDB.12.0;data source=..\Hy-Tech Maint2.mdb"
            ds.Clear()
            con.ConnectionString = dbProvider
            con.Open()
            sql = "SELECT * FROM tblMachine WHERE MachineNumber =" & cboMachineNumber.SelectedValue
            dadapter = New OleDbDataAdapter(sql, con)
            dadapter.Fill(ds, "Machine")
            con.Close()
           
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try
If Not IsDBNull(ds.Tables("Machine").Rows(0).Item(4)) Then
            txtManufDate.Text = ds.Tables("Machine").Rows(0).Item(4)

  If Not IsDBNull(ds.Tables("Machine").Rows(0).Item(5)) Then
            txtModelNumber.Text = ds.Tables("Machine").Rows(0).Item(5)
        End If

        If Not IsDBNull(ds.Tables("Machine").Rows(0).Item(6)) Then
            txtSerialNumber.Text = ds.Tables("Machine").Rows(0).Item(6)
        End If

        If Not IsDBNull(ds.Tables("Machine").Rows(0).Item(7)) Then
            txtLocation.Text = ds.Tables("Machine").Rows(0).Item(7)
        End If

        If Not IsDBNull(ds.Tables("Machine").Rows(0).Item(8)) Then
            chkPLC.Checked = ds.Tables("Machine").Rows(0).Item(8)
        End If

        End If

So my Question is When I make any changes or additions to the database can I update them referencing them at Row (0)?
I know if the query is open in MS Access it will allow me to make the changes to this but now I'm not sure how to code the update from
where I'm at.
The form shows only data for this one record.
Seems like I need to be explicate on the record I'm updating but not sure how to.

Thanks

Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>