Hello all,

I created a class in Visual Basic, In the class I get a filename as parameter and display its size as a output, and I make it as .dll and I register the .dll in the server.

After that I try to register the class in Sequel server by means of the below commands
DECLARE @object int
DECLARE @hr int
DECLARE @property varchar(255)
DECLARE @return varchar(255)
-- Create an object.
EXEC @hr = sp_OACreate 'Xp_Filesize.clsconvert', @object OUT
select @hr

It gives an output -2147221164, it means that the class is not registered in Sequel Server. I dont know How to register the class in Sequel Server? If anyone knows help me to resolve the problem.

Thanks.

and my procedure is

create procedure x(@filename varchar(100))
as
begin
DECLARE @object int
DECLARE @hr int
DECLARE @property varchar(255)
DECLARE @return varchar(255)
-- Create an object.
EXEC @hr = sp_OACreate 'Xp_Filesize.clsconvert', @object OUT
select @hr
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
-- Set a property.
EXEC @hr = sp_displayoaerrorinfo @object, &#39;FileSize&#39;,@filename
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
-- Get a property using an output parameter.
EXEC @hr = sp_displayoaerrorinfo @object, &#39;FileSize&#39;,@property
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
PRINT @property
-- Get a property using a result set.
EXEC @hr = sp_displayoaerrorinfo @object, &#39;filesize&#39;
IF @hr <> 0
BEGIN
EXEC sp_displayoaerrorinfo @object, @hr
RETURN
END
end