dataset not updating after an insert

M

mw

Hi,

I'm having trouble getting a dataset to update (refresh)
after and insert. The dataset gets data from a
dataadapter and is bound to an Infragistics datagrid
(doesn't really matter). When I add a new row, the
insert is happening properly, but when I refresh the
grid, the row doesn't show up.

I've checked the dataset before the grid gets populated
and the data isn't there after the insert.

The data components are all on the form designer. The
code that does the update in the click event of a button
is (again, when I check the database, this bit is working
because the row is in the table):
SqlDataAdapter1.InsertCommand.Parameters("@isp").Value =
CType(cmbISPs.SelectedValue, String)
SqlDataAdapter1.Update(DsMessages1)

After that, the code that should refresh the dataset
(based on an input value from a combo box):
DsSelfServMessages1.Clear()
Try
SqlDataAdapter1.SelectCommand.Parameters
("@isp").Value = CType(cmbISPs.SelectedValue, String)
SqlDataAdapter1.Fill(DsMessages1)

System.Diagnostics.Debug.WriteLine
(cmbISPs.SelectedValue & " -- " &
DsSelfServMessages1.spU_ListMessages_M.Rows.Count)
'rebind to the infragistics grid
ugMessages.DataBind()

Catch ex As Exception
MsgBox(ex.Message)
End Try

This is not the way that I'm used to coding, I usually do
data access in run-time, but I've inherited this
application and I don't have time to make any major
changes :) -- anybody know how that feels?

Thanks for any help.
 
W

W.G. Ryan eMVP

It looks like you're referencing two different datasets..DsSelfServMessages1
and DsMessages1. Just for debugging, setyour datasource to DsMessages1 and
see what happens there.
 
M

mw

my bad...that's a typo.
-----Original Message-----
It looks like you're referencing two different datasets..DsSelfServMessages1
and DsMessages1. Just for debugging, setyour datasource to DsMessages1 and
see what happens there.



.
 

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