Yamin Muyal writes "I'm using Windows 2000 Pro (SP2) and SQL Server 2000I'm trying to use the sp_OA's stored procedures to retrieve a list of the files in a specific folder. Everything goes fine until I try to use the command:EXEC @hr = sp_OAGetProperty @files, 'Item', @file OUTPUT, @ito get a pointer to the file. At this moment SQL returns an error without any description. To reproduce my problem, just paste the code bellow to Query Analyzer and run it: DECLARE @hr AS int, @fso AS int, @folder AS int, @files AS int, @file AS int DECLARE @count as int, @i as int DECLARE @FolderPath AS varchar(255) DECLARE @src AS varchar(255), @desc AS varchar(255) SET @FolderPath = 'C:\winnt' EXEC @hr = sp_OACreate 'Scripting.FileSystemObject', @fso OUT EXEC @hr = sp_OAMethod @fso, 'GetFolder', @folder OUT, @FolderPath EXEC @hr = sp_OAMethod @folder, 'Files', @files OUT EXEC @hr = sp_OAMethod @files, 'Count', @count OUT print @count -- that works set @i = 1 EXEC @hr = sp_OAGetProperty @files, 'Item', @file OUTPUT, @i IF @hr <> 0 BEGIN EXEC sp_OAGetErrorInfo @files, @src OUT, @desc OUT SELECT convert(varbinary(4),@hr) as COD_RETORNO, Source=@src, @desc as MSG_RETORNO RETURN END
Any help would be greatly appreciated!Thanks!"