trouble hooking up datatable rowchanged event - Miha, help!

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

I'm still having trouble hooking up the datatable rowchanged event to track
progress of the fill method. The code below errors out on 'can't find table
0', but no matter what I do I can't seem to get it to work.

Dim dahistd As New SqlDataAdapter("select bipad, issuecode, draw, net from
histd order by issuecode", oconn)

Dim dshistd As New DataSet("histd")

Dim dt As DataTable

dt = dshistd.Tables(0)

' add a RowChanged event handler for the table.

AddHandler dt.RowChanged, New DataRowChangeEventHandler(AddressOf
DataTableRow_Changed)

dahistd.Fill(dshistd, "histd")
 
Hi Bernie,

Yup, the runtime is right in throwing an exception.
You'll have to define the table before using dt = dshistd.Tables(0).

Just add the following line before:
dt = dshistd.Tables.Add("histd")

BTW, the your line
Dim dshistd As New DataSet("histd")
creates a dataset with the name of "histd" and not a dataset with a table
named "histd".
 
Back
Top