I would like to modify a file in the bd SQL Server
I am designing a C# application that stores word files in a SQL Server database but I like to open the files from my datagridview and save changes coming from MS Word.
This is less an answer than it is an extended comment. First, we don't "do it for [you]... if possible reproduce the code etc.". We help you by answering questions about coding that you ask, preferably by you showing us your code and asking questions about that.
But, here's an attempt to answer what you are looking for. I'm assuming this is Windows Forms (there's a winforms
tag you can use on your question, by the way). My assumption is based on your reference to DataGridView
.
By the way, a SQL Server database doesn't store files. It can store blobs of stuff that would normally be in a file, but not files. In what you seem to be describing, it's likely going to be storing OpenXML data that would normally be in a .docx
file.
I'm guessing that you are trying to build a Windows Forms app that has a DataGridView (DGV). Each row of the grid will represent one of your database-resident "files". It will have some metadata (like the "filename") and a control (likely a button) that will act to open the "file" in Word.
To do this, you will need to copy the blob of file data out of your database row and create an actual (temporary) file somewhere, and then start Word, pointing it to your newly created file.
The .NET Framework provides you with two tools you can use at this point.
When you start up another process, you get a reference to the process, and you can set things up so that you can be notified with the process ends. This way, you can tell when your user exits Word. Now, Microsoft tends to do special things with their applications, so this may require some finesse.
There's something in the Framework known as a FileSystemWatcher
. You can point it at a file and you will be notified whenever that file is updated or deleted.
What you want to do with this information is really up to you. After this, it is, as @siggemannen said in the comments, just a matter of figuring out what the parts of this are, and then writing code to implement those parts. Remember, if you have issues with your code, come back here, show us your code, and get answers.
Update:
You're begging me to write your software for you. That's not how this site works (and, I work for a living and don't have time to do your work). But, this should help.
.docx
)Exited
event handler.There you go.