How to edit a Word Document (.docx) stored in a SQL Server Table? - vb.net

How to edit a Word Document (.docx) stored in a SQL Server Table?
Here is the tentative work flow:
Read BLOB from SQL Table through Ideablade
Write BLOB to disk as .docx
Open .docx using Word
User makes changes
Save .docx using Word
Read .docx into BLOB
Write BLOB back to SQL Table through Ideablade
All sample code is welcomed?
I am sure there are a lot of people doing this already.
Any other ideas on how to simplify this process?
I am using VB.NET, .NET 3.5 SP1, WinForm and SQL Server 2008.

Well, as to the how, here is how to read a blob and write a blob to SQL. Although frankly, unless you have very good reasons such as an existing backup system, you would probably be best served storing the file to the file system and the path and metadata in the database. Either way, abstract it in your BLL, so you can change your mind down the road.

Retrieving and updating the BLOB from the db shouldn't be a problem, you'll find lots of sample code to do that on the net.
A simple approach to your problem would be to create a "temp" or "working" directory somewhere and monitor it with System.IO.FileSystemWatcher (sample code). When the user wants to edit a file, fetch it from the db and store it the directory. Whenever the user saves the file, you'll get a notification from your FileSystemWatcher, so you can save it to the database. Don't forget to empty the directory from time to time.

The method I've seen for this that I think works best is to build this as an add-on for MS Word itself. Examples include the Save to Sharepoint, Save to Moodle, and other similar add-ins.

Related

how can I get the data out of an .fb file?

I'm working with a company trying to setup a new database system as their old database software has gone out of business. All the data is in a .fb file that is encrypted (You used to have to get backups 'unlocked' before they would let you use them).
I've managed to get a copy of the database (I think it's unencrypted as I copied it while the database was open and then changed the copied files permissions using terminal).
The problem is that it's a .fb file and I can't find a way to 'open' it to browse the data...
Any Ideas?
Generally speaking, data stored in relational databases aren't just stored as ascii csv files. So you won't be able to just open up a .fb file in a text editor and grab the data.
If you're still able to query the database, you will need to have the frontbase server generate a dump of the data into a flat file.
See the frontbase documentation for backup and restore. Specifically 4.9.1. Exporting Schema and Content Data:
WRITE ALL OUTPUT('<output-directory>' [,'YES']);

.SQL export from PHPMyAdmin to Excel or CSV

I inherited some old records for a company I volunteer for. One of the old files is an SQL Dump from their old webpage, and I would like to get the data from one of the tables for their use into Excel.
-- MySQL dump 10.11
The dump drops the table if it exists, creates the table new, and then inserts all of the data.
Is there some easy way I can get this data into Excel on my PC? I don't have SQL Server or anything like that loaded... I assumed there was some easy way to get a CSV or Excel file out of it but I have failed to find this yet without first uploading the dump to some SQL Server.
Unfortunately I don't think that there is any way to export a dump file into an excel or .CSV file. The reason for this is that the dump file is actually a collection of Select statements instead of the actual data itself. SQL servers do this to prevent a whole list of problems that can occur when you try to manipulate raw data manually.
Lucky for you, MySQL offers a free version of their server. You can find it here: http://dev.mysql.com/downloads/
I think you are best off downloading this and restoring your file as a new database. This has the added benefit of allowing you complete control over the data from that point on. Exporting to excel would be easy at that point however, you may find it a lot more fulfilling to continue using MySQL server.
Hope this helped.

what format is most reliable for saving a history file from an application?

Good Afternoon,
I am in the process of developing in vb.net a simple “cheque printing” application which will allow users to fill in a few text boxes with the values that will be printed on a cheque.
When they hit the print button, the values will be sent to the printer, but I also want the values they input in the text boxes saved to a file, so like a history file of all the cheques that were created.
I am thinking to use either an access database or an excel spreadsheet as my history file, but I am not quite sure on which would be best.
Please note that in my environment storing this information in a SQL database is not an option and also this file will most likely be stored/accessed from the network.
The history file needs to be:
1.Stable (cannot corrupt easy)
2.Reliable
3.Easily exportable in case we need to export the information to one of our in-house systems.
4.editable from the application I am developing
Kindly advise,
A
XML. Save the data to DataTable object and then use the .WriteXML method to save it as an xml file. I'd advise creating a strongly-typed DataTable class for this, so that the XML can be exported with a reliable schema and imported easily.
If you are using different fonts, you could use a .rtf (rich text format) which will save the format of the text that you send to print... it is a universal file format, you can open it with open office, ms office, or any office suite you have...
Access will be best choice,
it's relational database and can make a form from this file to do what are you looking for without VB or any code.
Also you can access this file from network.
for more detail about setting for this file go to this link
http://goo.gl/bOfGp6
and you will find more options complete your work.
I would use a MySQL server. It's free.
XML is also good, but I hate sharing folders...

VB.net connection to embedded database

I have a stand-alone Windows Form app written in VB.NET that currently connects to a local Access DB (.mdb file) and consumes data from several of the tables. It never writes to nor modifies the DB. I'm trying to figure out how to secure this DB so the user has no access to it. I'm thinking the best way is to store the DB as an embedded resource within the project. However, I can't figure out how to make this work.
I've added the .mdb file to the project resources and set its properties to "Embedded Resource" and "Do not copy." But now how do I reference the DB to create the connection?
Before I used the connection string "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb"
How do I write the connection string now with reference to an embedded resource?
"I'm thinking the best way is to store the DB as an embedded resource within the project."
This usually relates to old skool security, in the olden days DotNetNuke developers that used Access dBs as their backend actually renamed the .mdb to .resources as you cant download a resource file from the web.
"Would it be better to export the DB to xml or something like that and then use a stream reader as opposed to a database connection?"
No. You cant read an Access file from a stream And an XML dB has even less concurrency support than an Access Database.
If you really need to protect the data, then you've absolutely chosen the wrong data store.
#JohnBustos wrote "Store the DB remotely and have the program access it over the internet."
Please do not do this. If anything put it on a network share and restrict access. Then look at upgrading the access dB to SQL Server.
Yes, I have had the same problem and I converted the database into a XML or even a TXT file that is embedded. It works very fine !
Sorry, I never closed this out.
My solution was even simpler than those proposed. You can add the .mdb file to the project itself and not mess with the whole "Resource" business. Then set the file's Copy to Output property to "Do not copy". So the .mdb gets compiled into the app, but file itself is not available to the user.

How do I open / edit a .sdb file

I have a .sdb database file which I need to open. It's the database behind Song Pro (http://creationsoftware.com/).
Google seems to think that openoffice may be able to open this, as it might come from star office. But I can't persuade the file to open in Base 3.2 and there are no reliable instructions as most google results are of the extension definition type.
Initially I could do with doing this in a database browser to see how the database is laid out. But assuming it is holding the correct data I will then want to do this programmatically.
Any help much appreciated.
Thanks
Jona
This page says that the SongPro .sdb file is an MSAccess database and you can just rename it to .mdb and open it with MS Access. There's also a script linked that someone has written to convert the contents of the database.