I have a legacy FoxPro application which stores documents in an SQL table in a field with the image datatype. FoxPro accesses the image datatype as a "General" field which can be used to store various files. I have a FoxPro control which interfaces with the General field for modifying/viewing the document that was stored. I need to migrate this control to .NET and make it easy for users to view/modify documents of various types.
Does anyone have any suggestions on some ways to go about this or know of things that I'll need to consider for the migration to .NET? I'm pretty sure that I'll need to migrate the field to either a varbinary(max) or FileStream data type.
Are you sure you want to continue holding the documents in the database? What's good for Foxpro isn't always good for .Net
You're probably going to have to use Foxpro to read the general fields, and either upload them or save them locally for another app to upload.
Have a look at Can I extract a file from a foxpro general field? for good info on general fields and http://blogs.msdn.com/manisblog/archive/2007/10/21/filestream-data-type-sql-server-2008.aspx for a filestream vs varbinary comparison
Related
This one's going back to the basics but I haven't been able to find a simple explanation anywhere. I just started working with databases and I'm using a SQL Server database managed mostly with navicat (but I have SQL Server Management Studio as well) and I need to store a PDF or image in the database.
I'm using Entity Framework to interface the database with the C# app I am building. A simple explanation assuming little knowledge of database management would be much appreciated.
Thanks for the help.
The database size will grow exponentially if you start storing images and PDF's.
A better approach would probably be to store the path of the file in the database and then load the item by referencing the proper path.
EDIT:
It's going to depend on the file structure of your application really. A simple version of retrieving a PDF could be the following:
Example Path:
/PDF/username.PDF
You store the path of the PDF in the DB, maybe under pdfPath. Then when you retrieve the path from the database direct the user to the correct link using the path you got from the query.
I would like to know if there is a place to save a file that contains some data (that is used internally by the application - like a very tiny db). I don't want to save it to C:\file.txt. Is there a place where visual basic can hold these kind of files, like bin or something?
Thank you.
You can use the path in the VB object My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData or My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData to store what you want.
It is not clear what kind of data you are talking about (type, size and usage), but an embedded database may be just what you are looking for.
SQL Server Compact Edition or SQLite may do the trick.
You have a few choices.
You can store data in Arrays, XML files, A SQL Database (Access, SQL Server, etc).
You can use your local user locations that are user specific.
IT all depends on how much data.
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.
I'm using Sql Server 2008 FullText Search for a project. I need to be able to search PDf files, and I had some questions relating to that:
How do I enable PDF searching? I've heard of the adobe filter, but couldn't find a clear guide on how to get started.
Are the PDF files stored in the DB itself, or in the file system? I was mainly concerned about the space on shared hosting services like DiscountASP. Typically, we get only about 100MB of space for the DB, but a lot more (in GBs) for the File System.
So, if these PDF files are going to be stored directly in the DB, then it may get expensive, right?
I would like to provide snippets of the search results (like Google). How can I achieve this with Sql Server 2008 FTS?
Full text search can only search database content. It will not index content outside the database. Fulltext is extensible through a programming API and Adobe has providers for PDF content, as you already know. SQL Fulltext can use those providers.
However there is another feature you may be interested in, namely the new SQL 2008 FILESTREAM data type. Filestreams are stored in the file system as files but are maintained as part of the database from the point of view of transaction consitency, backup and restore etc. Luckly FILESTREAM and FULL TEXT work together.
Sounds like you want to use Microsoft Indexing Services
This will index files on the file system so you can search their contents.
Here is an example of querying indexing services using ASP.NET
You need a PDF IFilter. Here's the one from Foxit Software.
I believe you can only use 'Sql Server Full Text Search" if the PDF files are stored within the database.
I haven't found a way to do this other than opening the file and searching for the context myself for each result.
I've just designed a large database by playing around in MS Access. Now that I'm happy with the design, I need to be able to generate this same database (tables, relationships, etc.) from code.
Rather than hand-writing the SQL CREATE statements (which will be long, tedious, and error-prone process), I was wondering whether there was a shortcut. I seem to recall from my limited exposure to MySql that I was able to export an entire database as an SQL statement that can then be run in order to regenerate that database.
Do you know of a way to do this in MS Access, either through the GUI, or programmatically?
I just found and tried out this tool: jet-tool. It seems to work well for Access 2010.
For free for 30 days (then $30) you can give DBWScript a go, looks like its what you are asking for, although not in native Access GUI or programmatically
The quick and dirty, easy, perfectly legitimate way to do this is just copy the .mdb file. Empty out the data if you need to - usually there are static tables that are handy to leave populated, however.
I use a free utility called MDB Viewer Plus (http://www.alexnolan.net/software/mdb_viewer_plus.htm).
Launch it, open your db, then select your table.
On top menu, select "Table > Generate SQL - CREATE".
I don't know what tools you have on your development machine, so this may or may not be helpful.
You can easily transfer your Access database to Microsoft SQL Server using the Upsizing Wizard.
The express edition of SQL Server is available for free > here.
You will also want to get the free Management Studio Express.
Using these free graphical-based tools you can easily generate the SQL statements to re-create the database. You will have the Create statements you are looking for and they will be placed in a text file.
The Bullzip is very good to this. Very simple. See bullzip Access to MySQL for example
It is possible export any tables to SQL or migrate automatically.
Access to MySQL is a small program that will convert Microsoft Access Databases to MySQL.
Wizard interface.
Transfer data directly from one server to another.
Create a dump file.
Select tables to transfer.
Select fields to transfer.
Transfer password protected databases.
Supports both shared security and user-level security.
Optional transfer of indexes.
Optional transfer of records.
Optional transfer of default values in field definitions.
Identifies and transfers auto number field types.
Command line interface.
Easy install, uninstall and upgrade.
The thing that you're mentioning in MySQL is sql dumping. Very useful feature. If you want to migrate the database to mysql, here's a helpful article.
http://www.kitebird.com/articles/access-migrate.html#TOC_4
I have been using for years a tool called database.net from https://fishcodelib.com/Database.htm
I generally use it on client's site as a portable version of SSMS (drop and run), but it can handle a multitude of RDBMSes, including Access.
Connect to your mdb/accdb, right click any table, choose SCRIPT AS, Create, and you're done.
If you right click Tables header, you can select multiple tables to generate, but I think it's a feature of the paid version.
I have no acquaintance with them, just a happy client.
I found an easy way to go:
Export-> ODBC Database
and then retrieve the SQL form there (e.g via pgadmin on postgres)
Compare'Em
http://home.gci.net/~mike-noel/CompareEM-LITE/CompareEM.htm
The free version creates VBA while the $10 pro version gives you DDL statements.