Hi..
I want transfer a image from my excel spreadsheet to a web server and i have written a web services so that it accepts a filename and then dumps it into web server.. if i just called that code in vb it works fine... but when i run the service it doesnt work.. this is the error that i am getting
System.Web.HttpException: The component 'ADODB.STREAM' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive.
at System.Web.Util.AspCompatApplicationStep.CheckThreadingModel(String progidDisplayName, Guid clsid)
at System.Web.HttpServerUtility.CreateObject(String progID)
at MyService.Service1.getFileBytes(String flnm, String stype) in C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\MyService\MyService\Service1.asmx.vb:line 31
at MyService.Service1.Sendit(String sFilename, String Stype) in C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\MyService\MyService\Service1.asmx.vb:line 21
at MyService.Service1.UploadFile(String Filename, String sType) in C:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\MyService\MyService\Service1.asmx.vb:line 16
and this is my code
Any help will be appreciated..Code:Public Function getFileBytes(ByVal flnm As String, ByVal stype As String) Dim objstream As Object objstream = Server.CreateObject("ADODB.STREAM") If stype = "on" Then objstream = 1 End If objstream.open() objstream.LoadFromFile(flnm) If stype = "on" Then getFileBytes = objstream.Read Else getFileBytes = objstream.ReadText End If objstream.Close() objstream = Nothing End Function
Thanks,
Karen




Reply With Quote