updating controls on a form when database is updated 
Author Message
 updating controls on a form when database is updated

hi all
I am using VB.net for my project where I need a form to
display the recent data in the data base
that is I want to display a row of a table in the form
and keep updating it as and when the database is updated
is there any other way to do this other than using a timer
and keep querying the database??
thanks in adv
Kedar


Fri, 09 Sep 2005 00:42:33 GMT  
 updating controls on a form when database is updated
If you bound the form to a DataSet in the program, you will need to
re-query the database timely. Dataset is an client side component, it can't
detect the changes in underlying database.

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Sun, 11 Sep 2005 16:42:55 GMT  
 updating controls on a form when database is updated

You can also bind your control to a dynamic recordset, which is automatically updated when something change in your database...
Follow the following line:
(First, set reference to MICROSOFT ActiveX Data Objects 2.5 (or any other Version) and to MICROSOFT Data Binding COllection VB 6)

and try this

Dim rs as ADODB.Recorsdet
Set rs = new ADODB.Recordset

rs.Open "SELECT * FROM MmyTable", adOpenDynamic, adLockReadOnly
' * This adOpenDynamic is the Magic guy in this case...
' ** Using adOpenDynamic will let you Recordset a lot more heavier than usual (in fact this is the haviest mode).. But it automatically catches New Entries into the database and Updates that has been Done... if you want to catch only Updates (no new Entries).. you should use adOpenKeyset...

Dim bc as BindingCollection
Set bc = New BindingCollection

bc.DataSource = rs
bc.Add MyTextBox, "Text", "myTableField1"

' * Your command is binded to your Recordset...

Well .... hope it helps

Daniel


Quote:
> If you bound the form to a DataSet in the program, you will need to
> re-query the database timely. Dataset is an client side component, it can't
> detect the changes in underlying database.

> Luke

> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)



Sun, 11 Sep 2005 19:54:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I am trying to update a record, i am not using data control

2. I am trying to update a record, i am not using data control

3. Updating a single OLE link for a record OR updating existing database

4. Updating a Combobox after Database Update

5. (DBGrid) Updating Appearance with out updating Database

6. (DBGrid) Updating appearance without updating Database

7. Bound controls not updating ADO with adodc.recordset.update command

8. Controlling Updates in ADO using timestamp/update criteria

9. Help: Edit form does not update database

10. Newbie: Delete Records form Database, Update from Listbox

11. Database not updated from form

12. Newbie: Delete Records form Database, Update from Listbox

 

 
Powered by phpBB® Forum Software