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 AttachFileStream.Open() AttachFileStream.LoadFromFile(fname) rs = New ADODB.Recordset rs.AddNew() rs.Fields("reportFile").Value = AttachFileStream.Read rs.Update() AttachFileStream.Close() ========== End ==================== 2) Office Automation Executable in VB.Net (Visual Studio 2005) ========== Code 2 ================== myExcelApp = New Excel.Application <== creates Excel via VB.net Windows app ========== End ==================== As with example #1 above, I would like to save "myExcelApp" directly to SqlServer 2000/2005. Thanks for your help. |
All times are GMT +1. The time now is 06:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com