views:

67

answers:

3

Hi,

I would like to build a Shared Documents Library in ASP .Net and SQL Server but I have a problem, the customer wants to open the documents (stored in SQL Server) in Office UI and when save it, the document should be saved directly in database like SharePoint Server.

I've been researched on web since last week and I didn't found any answer or specific technology to do this.

Do you have any idea?

Thanks,

Sergio

A: 

I don't know of any tools to do this, but I see two possibilities:

1) Save a pointer to the file in the DB instead of in the DB itself. I think this is closer to what Sharepoint actually does, but I could be wrong, there.

2) Store the document as OpenXML (in an Xml datacolumn). Then, using Office Interop, open the Word (or whatever) and pass it the OpenXML data to generate the actual document. When the user clicks 'save' save it back to the DB as OpenXML.

------ Bonus Idea ------

3) (For small enough files) You could also use NVARCHAR(MAX) fields in your DB to store the data, if necessary, though storing the formatting information can be a little difficult.

AllenG
+2  A: 

I believe it would be best to store the information within the documents or perhaps the file paths rather than the documents themselves. None the less, it is possible to achieve what you wish to accomplish.

In your ASP.NET site, you will need to add a functionality to import/export some MS Office documents.

Solution 1

The site could allow a user to upload a document in a folder on the server and the site could store the file path in the database. For the download part, you could simply select the proper file path so that the user can download the document he/she wishes.

Solution 2

The site could allow a user to upload a document and store it in the SQL Server database. The documents could be stored as BLOBs. In SQL Server, you can use the varbinary(max) datatype for that. It would be rather tricky for the download part...


Here are some sites to help you out:

  1. http://support.microsoft.com/default.aspx?scid=kb;en-us;258038
  2. http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=169&messageid=243427
  3. http://weblogs.sqlteam.com/peterl/archive/2007/09/26/Insert-binary-data-like-images-into-SQL-Server-without-front-end.aspx
Alerty
A: 

SharePoint provides a WebDAV interface to update its files. Now, it may be a hefty bite to chew, but if you were to develop a WebDAV interface, that could be the ticket.

Take a look at this article, where something similar is described. Perhaps it will help you get started.

http://thehojusaram.blogspot.com/2007/06/c-webdav-server-with-sql-backend-source.html

kbrimington