trouble hooking up datatable rowchanged event - Miha, help!

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")
 
M

Miha Markic

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top