Opening an Excel TEMPLATE that is Stored as a BLOB in SQL Server

I have a table that stores EXCEL templates.  :

Here is what I have:

set cn=SERVER.CreateObject("ADODB.CONNECTION")
cn.ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;" & _
    "Initial Catalog=dbAS_FAC_CENSUS;Data Source=ASDEV" & _
    ";User Id=" & Request.Form("txtUserID") & _
    ";Password=" & Request.Form("txtPwd")
cn.Open
set rs=server.CreateObject("ADODB.RECORDSET")
set rs.ActiveConnection=cn
rs.Open("SELECT * FROM vwMART_REPORTS WHERE strUserID='" & Request.Form("txtUserID") & "'")

THE rs("Report") field has the actual Template.  How do I open the contents of that field in Excel?
clanglAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richie_SimonettiIT OperationsCommented:
you have to create a temporary local file and open it.
0
clanglAuthor Commented:
But how do I get it from the table to a local file?
0
Richie_SimonettiIT OperationsCommented:
OK. You need to use ADDB.stream object (more on this later)
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Richie_SimonettiIT OperationsCommented:
0
Richie_SimonettiIT OperationsCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clanglAuthor Commented:
with the ADo stream method....
What my goal is, is to have them click on this link on a web browser that points to that Field in the table and then have excel open right up......
0
Richie_SimonettiIT OperationsCommented:
But that's a complete diferent scenario!!!
0
Richie_SimonettiIT OperationsCommented:
You need to create/extract the file at server side after user does the click and navigate to resulting xls file. It should be opened in web browser window.
0
clanglAuthor Commented:
This will work but I need to be able to do this with out saving it to a file.  I will post another question.  Thank you for your help.
0
Richie_SimonettiIT OperationsCommented:
Hummm, i think you can't but i maybe wrong.
Thanks for "A" grade.
0
clanglAuthor Commented:
I ended up not using a stream.
Just in case you ever need something similiar here is what I ended up doing:

<%
Response.buffer = TRUE
'on error resume next
dim strReport
strReport=left(Request.Form.Item,instr(1,Request.Form.Item,"=")-1)
'Response.Write strReport

dim cn, cmd,rs
set cn=SERVER.CreateObject("ADODB.CONNECTION")
set rs=server.CreateObject("ADODB.Recordset")
cn.ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;" & _
    "Initial Catalog=dbAS_FAC_CENSUS;Data Source=ASDEV" & _
    ";User Id=" &  Session("User") & _
    ";Password=" & Session("Pwd")
cn.Open
set cmd=server.CreateObject("ADODB.Command")
set cmd.ActiveConnection=cn
cmd.CommandType=4
cmd.CommandText="sp_MART_GetReport"
set rs=cmd.Execute(,strReport)
set fld=rs.Fields(0)
cBytes = fld.ActualSize
Response.Clear
'Response.ContentType = "application/vnd-ms-excel"
      Response.ContentType = rs.Fields(1).Value
      Response.AddHeader "Content-Disposition", "filename=a.xlt;"
      Response.BinaryWrite (fld.GetChunk(cBytes))
rs.Close
set fld=nothing
set rs=nothing
set cmd=nothing
cn.Close
set cn=nothing

%>
0
Richie_SimonettiIT OperationsCommented:
excellent!!, that's for sure far ago from my knowledge. excellent work again.
(I really think you accepted my comment too soon :)
0
clanglAuthor Commented:
I ended up using your answer to back in all the Templates to the SQL Database.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.