I made my winform application with C#, and i use entity framework 5. I use also MySql to my DB.
i like to have my DGV always updated and displa ythe "newest" data.
To use SqlDependency is the best way to update any control if there is a modification happened on DB's data?
Thank you to advice me?
Related
I'm learning EF DB first, I have updated one table column and I found a solution from the official document to refresh the model.
Right-click anywhere on the design surface, and select Update Model
from Database.
Is there a way to do this programmatically.
Is there any programmatic solution to that?
No. There is no (common) scenario where updating the model from the database is useful without making manual changes to your code. So there would be little point in in automating that.
I have successfully bound a SQLite database table to a DevExpress XtraGrid control, and can see the few test rows I have, and can also edit the values, and commit the changes back to the database with an Update command upon closing.
My question is what would be the best way for me to insert rows to the table? I have implemented and successfully used some example code for inserting rows into a SQLite table, however I am uncertain if the DevExpress XtraGrid has some type of method to allow me to skip all of the example code I have, and simply use the same functionality that seems to be already built into the control.
So should I use example code that connects to the database, builds the query then runs it on the database, or is there a better way, using something already built into the DevExpress WinForms suite?
Thanks.
You can use Embedded Navigator controls to insert rows !
https://www.devexpress.com/Support/Center/Question/Details/Q235790
After some research, I found that the best way to interact with the data in the grid, or with any database for that matter, is to use DevExpress's eXpress Persistent Objects for .NET. Great bit of technology. It allowed me to specify the database and table I was interested in, and it created all of the plumbing to allow me to deal with rows in the table like normal C# objects with properties.
If you are struggling with trying to mix in SQL queries and the like into your application, I highly recommend you make your life much easier and use XPO.
Here is a link to the documentation describing XPO: http://documentation.devexpress.com/#XPO/CustomDocument1998
I am developing application that works with sql server, I read and update data from (by) multiple sources.
Because of that, there is a problem that one updates already updated data....
How can I deal with that issue?
(I know EF has built in Concurrency mode but if I understand right, if my design creates and disposes contextobject every time this won't work)
The secret is normally to use a timestamp field and check that against the value in your object before you commit to the db. There's an article about this subject here.
I have a DataGridView using DataTable as my datasource. Now my problem is how do I keep my datatable synchronised to our server database? Like for example somebody tried to update the database so automatically my datatable will be updated too. Without using iteration. Is this possible?
There is nothing automatic in software. We need to automate things that seems to be automatic. You can use caching mechanism for your solution. The datatable can be filled using a cache. The cache can be made invalid on change of underlying tables in the database. And upon invalidating, the datatable shall have to be recreated again and so the gridview shall have to be updated.
If you are using ASP.NET, you can refer the MSDN article on the same here: http://msdn.microsoft.com/en-us/library/ms972379.aspx
Is this using WPF or Windows Forms?
Simple way: each client regularly polls the server and updates as needed.
More complex way: service oriented using callbacks, for example, http://www.switchonthecode.com/tutorials/wcf-tutorial-events-and-callbacks.
So I need to track changes that happen on a Mysql table. I was thinking of using triggers to log all the changes made to it and then save these changes in another table. Then I will have a cron script get all these changes and propagate the changes into the Mssql database.
I really dont expect a lot of information to be proporgated, but the data is very time sensitive. Ideally the MSSQL will see these changes within a minute, but I know that this requirement may be too high.
I was wondering if anyone had a better solution.
I have the bulk of the site written in .net but use vbulletin as the forums (sorry but there are no .net forums as powerful or feature rich like vbulletin)
The majority of the replicator tools use this technique. Fill another table on insert/update/delete triggers that containt the tablename and the PK or a unique key.
Then a reader reads this table, do the proper "select" if insert/update to get the data, then updates the other database.
HTH