DataSet fill problems
-
Hi Guys, What I have is a system that has a single table in a sql dbase and the entire contents of this table are dumped into a dataset via sqldataadapter.fill. Changes to this dataset can be sent back to the dbase fine using the sqldataadapter.update method without any problem as well. Where I am having problems is in the case that a second user adds rows (or alters existing data) in the database, I cannot seem to get this updated data to syncronize with my client's dataset. I am obviously doing something wrong here and I cannot seem to find an example that shows this. Can anyone please give me an example of how to do this? I have wasted a lot of time on something I am sure is very simple. Any help is much appreciated.
-
Hi Guys, What I have is a system that has a single table in a sql dbase and the entire contents of this table are dumped into a dataset via sqldataadapter.fill. Changes to this dataset can be sent back to the dbase fine using the sqldataadapter.update method without any problem as well. Where I am having problems is in the case that a second user adds rows (or alters existing data) in the database, I cannot seem to get this updated data to syncronize with my client's dataset. I am obviously doing something wrong here and I cannot seem to find an example that shows this. Can anyone please give me an example of how to do this? I have wasted a lot of time on something I am sure is very simple. Any help is much appreciated.
-
ADO.NET uses disconnected model. In multi user scenario it is not advisable to keep the data in the client side using DataSet. You must use update data in the database as and when needed, i.e. on demand.
So you are saying that at each syncronization I should do the following? - Update the dbase with any changes using the update method. - Empty the dataset - Re-download the entire table contents using the fill method ot the dataset This seems like an awful lot of work downloading for no reason (especially when the table has over 7000 lines). Is there no way to update the dataset contents with changes that have been made in the dbase. The table has an "id" column containing a unique id and a "datemask" column containing a datetime of the rows last update. Can this not be used to determine concurrancy?
-
So you are saying that at each syncronization I should do the following? - Update the dbase with any changes using the update method. - Empty the dataset - Re-download the entire table contents using the fill method ot the dataset This seems like an awful lot of work downloading for no reason (especially when the table has over 7000 lines). Is there no way to update the dataset contents with changes that have been made in the dbase. The table has an "id" column containing a unique id and a "datemask" column containing a datetime of the rows last update. Can this not be used to determine concurrancy?
No I am not saying that you should do the synchronization by calling update method. What I am trying to say is that DataSets do not fit well in this scenario. Typically, a screen has a refresh button in this case. And the user presses the button to refresh the data in the data pane which is generally stored in a DataSet. Consider the case when the table has 700000 lines, then what will happen. DataSets are designed to handle low transactional small data.
-
No I am not saying that you should do the synchronization by calling update method. What I am trying to say is that DataSets do not fit well in this scenario. Typically, a screen has a refresh button in this case. And the user presses the button to refresh the data in the data pane which is generally stored in a DataSet. Consider the case when the table has 700000 lines, then what will happen. DataSets are designed to handle low transactional small data.
ok, If datasets are not the best method, what storage method would I use? Probably best if I explain what I am trying to do... Currently I have a php/javascript contacts management system that runs on my companies intranet that I wrote and it currently has approx 7000 contacts in it. The idea of this system is to be a C# application that does exactly the same as the php version but, faster and easier to use. Now, a lot of my users are not local to the dbase server so I was trying to do the following: - Use dataset that syncronizes back to the sql server at regular intervals - Dump dataset to xml & schema for offline content, which would then load locally...and update from dbase server (To save long load times on startup and allow offline editing) I am fairly new to ADO.NET so I must admit to not knowing all the options available.
-
ok, If datasets are not the best method, what storage method would I use? Probably best if I explain what I am trying to do... Currently I have a php/javascript contacts management system that runs on my companies intranet that I wrote and it currently has approx 7000 contacts in it. The idea of this system is to be a C# application that does exactly the same as the php version but, faster and easier to use. Now, a lot of my users are not local to the dbase server so I was trying to do the following: - Use dataset that syncronizes back to the sql server at regular intervals - Dump dataset to xml & schema for offline content, which would then load locally...and update from dbase server (To save long load times on startup and allow offline editing) I am fairly new to ADO.NET so I must admit to not knowing all the options available.
DataSets are very heavy. You chould use instead create your own classes to hold and manipulate the the data. The data should be fetched from the database(synchronization) on demand. One question: Why is the client not connecting to the database directly instead on refreshing periodically? If you want to do this in the database side, When you select data from table, you put a lock using the below statement: select * from table holdlock then other users have to wait for this transaction to be completed for update. You can even use isolation level 2 (repeatable read) to keep the consistency.
-
DataSets are very heavy. You chould use instead create your own classes to hold and manipulate the the data. The data should be fetched from the database(synchronization) on demand. One question: Why is the client not connecting to the database directly instead on refreshing periodically? If you want to do this in the database side, When you select data from table, you put a lock using the below statement: select * from table holdlock then other users have to wait for this transaction to be completed for update. You can even use isolation level 2 (repeatable read) to keep the consistency.
The reason that I am not designing the system with direct dbase access is that the system will need to be used in offline situations where the user does a syncronization and then goes out on site with a laptop. The user can make changes offline and then, we he/she gets back online, can syncronize. This was the other reason I was looking at datasets due to their ability to dump to xml and schema (and import from same) which I was using for offline cache. I may look into have a table on the dbase that records all changes to any other of the dbase tables hence, rows updated since the last update could be downloaded easily. This might be a way to handle it.