Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE container for MS Word

Status
Not open for further replies.

quakeunity77

IS-IT--Management
Jun 3, 2010
36
US
I have an Access database with a table that has an OLE field that contains MS Word docs. I cannot find a corresponding control in ASP.NET. What can I use to display MS Word docs contained in the OLE field? Why has MS chosen not to include such a simple and useful control??
 
What can I use to display MS Word docs contained in the OLE field?
to start the desktop and the web are 2 very different environments. a desktop app runs on windows and is stateful. a web app generates html that is then rendered, typically in a browser, on a client's machine. that machine could be any browser on any OS. the web is also stateless.

2nd, typically you don't find MS Office loaded onto a web server, and even then the web server usually locked down so it couldn't access MS Office components anyway.

what you can do is load the document (either from file or database) into a MemoryStream. then you can pass the memory stream to the asp.net output stream and set the response headers to the appropriate type. something like "application/vnd.msword".

The server doesn't know it's loading a MS Word document. it just knows it's load a stream of data. The response headers allow the browser to interpret what type of content was returned from the server and appropriately display the content.

Why has MS chosen not to include such a simple and useful control?
Access is a tightly integrated application with the intention of allowing business users to design programs for the desktop using MS Office.

The .net platform is designed to create a common runtime environment so the application can run on, just about, any machine.

In other words Access and .Net are totally different tools that are designed to solve very different problems.

the asp.net framework is designed to handle http request/response. asp.net has nothing to do with the desktop, ms office, databases etc. asp.net is built on top of the .net framework.

webforms is an html engine built on top of asp.net. it's purpose is to generate dynamic html content.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks jmeckley for the reply. I can the get webserver or workstation to open MSWord since it already runs on the workstation and server. However, I cannot open the field in the database that contains an MSWord document.
 
yes, because ado.net doesn't know what the data type is.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
create a db script to alter the schema so files are stored as either binary data or a varchar with a link to file on disk. then use this new field as part of .net application. don't use data types that are specific to the integrated environment.

since you are changing the UI and logic it makes sense to also improve/alter the database as well.

some other things to consider. MS Access is the worst choice of db for any multi-user environment. it preforms poorly and doesn't allow for transactional behavior. which is crucial for rolling back changes when exceptions are thrown. replacing access with either sqlexpress or another open source db would be a huge benefit. of if you have the budget, replace Access with MS Sql or Oracle.

don't use data types

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks Jason

I agree with you that Access is not a good database. In fact the files were originally in a FoxPro database. I find it much easier to work with asp.net using Access database than Foxpro. I am used to Foxpro and am having problems with asp.net. How do I create a db script to alter the schema so files are stored as either binary data or a varchar with a link to file on disk?
 
tsql statements and/or VBA to migrate the data. you would write this yourself. it would be part of the deployment plan when moving the application into production. most likely it will need to be done in Access since you are working with Access specific data types.

Coming from FoxPro you are not alone in you struggles/frustrations with .net (asp, ado, etc...) just google "foxpro to c#/vb" and you will numerous FP devs with similar questions. FoxPro is an integrated environment, where .net is a development platform. two different tools designed to solve different tasks.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top