Saving Excel Sql Server Image Field



I have a document module function running a my website that displays txt,
pdf, xls, ppt, doc files that are stored in a Sql Server 2000/2005 database
table (image field). I would like to write a function triggered from a button
event that saves the spreadsheet directly to the database table.

I have 2 scenarios:

1) This routine writes the file disk and using VB.Net ADODB.Stream, saves to
the database. I would like to remove the save to disk code and convert
"This.Application" to an internal in-memory/in-process object which can be
written to the database.

======= Code Sample 1 ==============================
** VSTO Button Event Invokes SaveAs method and save to disk.
Dim AttachFileStream As New ADODB.Stream
AttachFileStream.Type = ADODB.StreamTypeEnum.adTypeBinary
rs = New ADODB.Recordset
rs.Fields("reportFile").Value = AttachFileStream.Read
========== End ====================

2) Office Automation Executable in VB.Net (Visual Studio 2005)

========== Code 2 ==================
myExcelApp = New Excel.Application <== creates Excel via Windows app
========== End ====================

As with example #1 above, I would like to save "myExcelApp" directly to
SqlServer 2000/2005.

Thanks for your help.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question