Dataset questions, vs2008

J

John

Hi

1. I am filling the dataset in my form load method as;

Me.MyTableAdapter.Fill(Me.MyDataSet.Clients).

What about the records that other users add to the database? Do I need to
run the fill command from time to time or will dotnet automatically fetch
these records periodically?

2. I am saving the data as below;

Me.Validate()
Me.MyBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)

How will system react when concurrency violation occurs? How will system
inform me of it and how can I handle that?

Thanks

Regards
 
M

Miha Markic

John said:
Hi

1. I am filling the dataset in my form load method as;

Me.MyTableAdapter.Fill(Me.MyDataSet.Clients).

What about the records that other users add to the database? Do I need to
run the fill command from time to time or will dotnet automatically fetch
these records periodically?

No, ado.net won't do anything by default. So, either you do fetch from time
to time or use SQL Server's notification services.
2. I am saving the data as below;

Me.Validate()
Me.MyBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)

How will system react when concurrency violation occurs? How will system
inform me of it and how can I handle that?

You might check "Optimistic Concurrency (ADO.NET)" help topic. Basically it
will tell you that an error happened (or not) in DataAdapter.RowUpdated
event.
 
W

William Vaughn

Miha is right. ADO.NET is simply an interface to the data--if you want to
refresh the contents from the server, you must requery. Notification
Services is really a very drastic move though. Another approach not easily
implemented by ADO.NET is a "server-side" cursor. In this case you can
create a "window" on the selected rows and when you position to a specific
row, the interface fetches the current contents of that row--and just that
row. I describe this in detail in my latest book. This is called an "ANSI
Cursor".

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 

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