Can the editing done in datagridview item change the value directly in the sql server of the table

I am binding a table in datagridview and I want that the user can edit the items in my form.Will the editing done here be updated in the sql server if i am using sql connection string.


That is doable as long as you're handling a proper PropertyChanged event for this type.

Aside, I would not recommend doing so, since this would necessitate to keep the connection alive until the whole editing is made, that is, one trip around the database for each property that has changed along the edit.

Should you want not to keep the connection, that will cost even more, since you'll have all the connection instantiation and opening overhead, yet your database engine might manage a connection pool for itself.

ADO.NET prefers an offline approach, I don't remember the term exactly. That is, connect to the database to load the needed data, and close and dispose it afterwards, so that another user may use the connection. Meanwhile, on your side, the user brings the changes he needs, then when he's done, he persists them into the database, and then only one trip around the database is required for a bunch of changes, which looks to me to be more productive and more performant.

Need Your Help

PHP convert from MySql to Excel Spreadsheet Autosize Columns

php mysql excel phone-number autosize

I am currently exporting tenant data from my MySql database into an Excel spreadsheet, using the code below.

How do I add the contents of a .htm file to a string?

excel vba excel-vba outlook outlook-vba

I want to add the default signature to the end of an email that is being sent from a Userform in Excel. However, due to the body being HTML (for reason I cannot change) the signature it not display...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.