PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework DataGrid Requery

Reply

DataGrid Requery

 
Thread Tools Rate Thread
Old 22-06-2007, 12:04 AM   #1
Nigel Vandyk
Guest
 
Posts: n/a
Default DataGrid Requery


I am using a CF +++datagrid to show several rows in a SQLCE table. When I
delete or change a row in the table I would like the datagrid to reflect the
change.

At the moment I am having to write (for example):

sqlcmd = "DELETE FROM Customers WHERE CustID=" & CustID

cmd.Connection = cn

cmd.CommandText = sqlcmd

cmd.ExecuteNonQuery()

MsgBox("Customer deleted") ' now to refresh the Datagrid.....!!

sqltext = "SELECT CustID,CustName,CustTel,CustBAdd1 FROM Customers"

cmd = New SqlCeCommand(sqltext, cn)

da = New SqlCeDataAdapter(cmd)

dt.Clear()

dt = New DataTable("Clients")

da.Fill(dt)

ds.Tables.Add(dt)

Me.DGClients.DataSource = ds.Tables("Clients")

What I would love is a function like DGClients.Refresh which would then
cause the Datagrid to refresh itself from the datasource. However Refresh
just redraws the control. Is there a neater and more efficient way of
updating the grid?
--
With best wishes


Nigel Vandyk

8 Finchley Way, N3 1AG
Tel: 020 8349 4714
Fax: 020 8346 2413
Mobile: 07976 655709
Website:www.astarsoftware.co.uk


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off