RE: open a text file using sp_oamethod
From: vishal subramaniam (vishalsu_at_microsoft.com)
Date: 05/26/04
- Next message: Sergei Almazov: "Re: Accept cascading delete and regject others"
- Previous message: vishal subramaniam: "RE: SQL Server: Buffer Manager - Free Buffers"
- In reply to: Carlos Ortega: "open a text file using sp_oamethod"
- Messages sorted by: [ date ] [ thread ]
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.
- Next message: Sergei Almazov: "Re: Accept cascading delete and regject others"
- Previous message: vishal subramaniam: "RE: SQL Server: Buffer Manager - Free Buffers"
- In reply to: Carlos Ortega: "open a text file using sp_oamethod"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|