RE: open a text file using sp_oamethod

From: vishal subramaniam (vishalsu_at_microsoft.com)
Date: 05/26/04


Date: Wed, 26 May 2004 07:02:44 GMT


vishalsu@online.microsoft.com

ISSUE:
=======
'm trying to write a text file using a SQL store procedure. I'm using the
sp_oamethod to open a text file using the following sentence

declare @o int, @f int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'opentextfile', @f out, 'c:\test.txt', 8, 1

I'm getting the error: ODSOLE Extended Procedure - Error in parameters, or
attempt to retrieve a return value from a method that doesn't supply one

May you say me how solve it?

RESOLUTION:
================
FIX: sp_OAGetProperty Fails on Properties From Inherited Interface
View products that this article applies to.
This article was previously published under Q236440
BUG #: 18763 (SQLBUG_65)
55840 (SQLBUG_70)
SYMPTOMS
Using sp_OAGetProperty to retrieve a property value from an inherited COM
interface fails. If the property value is requested as an OUTPUT parameter,
the following error is returned:

Error: 2147745792 (0x80040000)
Source: ODSOLE Extended Procedure
Message: Error in parameters, or attempt to retrieve a return value from a
method that doesn't supply one.
When no OUTPUT parameter is supplied, such that sp_OAGetProperty would
generate a result set, the command will return an empty result set.
CAUSE
If an OUTPUT parameter is requested, sp_OAGetProperty must confirm that the
interface supports the call and that it returns a value that is of the same
datatype as the one supplied. However, it fails to correctly walk the
object hierarchy to determine this information and will generate an error
if this occurs.
STATUS
Microsoft has confirmed this to be a problem in SQL Server 7.0. This
problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server
7.0. For information about how to download and install the latest SQL
Server Service Pack, see the following Microsoft Web site:
http://support.microsoft.com/highlights/sql.asp

For more information, contact your primary support provider.
MORE INFORMATION
Consider, for example, the Command object in Active Data Objects (ADO). In
ADO 2.x, the Command object inherits from an interface named _Command15,
which was the ADO 1.5 version of the interface. If sp_OAGetProperty is used
to request a property in the base interface, such as Parameters, an error
occurs. The following code snippet demonstrates the problem: exec @hr =
master.dbo.sp_OACreate 'ADODB.Command', @ADO_Command OUT
if @hr <> 0
begin
        print "failed in command creation"
        goto fatal_exit
end

..

exec @hr = master.dbo.sp_OAGetProperty @ADO_Command, 'Parameters',
@ADO_parms OUT
if @hr <> 0
begin
        print 'Failed in GetProperty'
        goto fatal_exit
end

fatal_exit:
..

LINKS:
=======
http://support.microsoft.com/default.aspx?scid=kb;EN-US;236440
This posting is provided "AS IS" with no warranties, and confers no rights.



Relevant Pages

  • Re: SP - output parameter not coming back
    ... > Also I have tested the SP using SQL Query Analyzer and it does not ... If it does not work in query analyzer, it has no chance of working in asp ... > If I do not find out about the output parameter I am considering ... You definitely need to work on the stored procedure so that you can see the ...
    (microsoft.public.inetserver.asp.db)
  • Re: Application, database and schema?
    ... > hardware interface for the monitoring. ... This subsystem understands how to talk to the ... > this case an RDB with a SQL interface. ...
    (comp.object)
  • Re: code sharing for sql2k and sql-ce
    ... I think the idea of coding against an interface is perfect given what you're ... "ExecuteNonQuery", ... You should not have to put SQL in your ... > So it seams that I will have to use sql statement in source code, ...
    (microsoft.public.sqlserver.ce)
  • Re: Opinions on approach, please...
    ... Write the where clause manually, ... MOST interface, with the original COBOL ISAM access commented out above it. ... I can certainly do it with dynamic SQL and MOST can build a WHERE statement ... application is doing lengthy sequential processing, how often, in what ...
    (comp.lang.cobol)
  • Re: Putting data in SQL server ?
    ... web interface while keeping the MDB frontend. ... the data into SQL server. ... regarding such a conversion? ...
    (microsoft.public.access.tablesdbdesign)