Hello to all, Maybe first small introduction: - SQLServer 2000 SP3, - XP Pro EN, - ActiveX, - SP in database It should working like this. There is a instanse of an object working, which recieves "telegramms" from all clients, including SQLServer. In SP I set the special properities (see code below) and it works. Also works the method, which I call by this object. The only thing which is not working is, that I cannnot read the object property, which I try to read! I was trying already, to do something that the SQL server want blocking the object, but it is not the case. Below the code: --------------------------------------- declare @iRetVal int declare @iObject int declare @sProperty varchar(2560) declare @sSource varchar(1000) declare @sDescription varchar(1000) declare @sLog varchar(1000) declare @dDateEVT datetime declare @sText1 varchar(10) declare @sText2 varchar(10) declare @iProperty int declare @nMessageNr numeric declare @bstrDateTime varchar(100) declare @textFromA1 varchar(100) declare @textFromA2 varchar(100) declare @i int set @iObject = 0 set @dDateEVT = getdate() set @iRetVal = 0 set @sText1 = 'AA00000000' set @sText2 = 'BB00000000' set @iProperty = 7 set @i = 0 -- {034188F2-8DBC-4613-829A-76D5279C35A3} exec @iRetVal = sp_OACreate 'RAIDSSimComponents.pidMessenger', @iObject OUTPUT,1 IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG1: No object created. Source: ' + @sSource + ' Description: ' + @sDescription print @sLog end -- Set the object property exec @iRetVal = sp_OASetProperty @iObject, 'FollowFromB', 1 IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG1: Error by setting property FollowFromA' print @sLog end exec @iRetVal = sp_OASetProperty @iObject, 'FollowFromB_EventID', 555 IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG1: Error by setting property FollowFromB' print @sLog end -- Call method exec @iRetVal = sp_OAMethod @iObject,'SendNotification_FromA', @iProperty OUT, 555, @dDateEVT, @sText1, @sText2 IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG1: Error by setting property FollowFromA' print @sLog end set @sProperty = '?' set @i = 1 -- Start the while loop, to give the time that the object set the property while @sProperty = '?' begin -- Do something to make the object not busy any more select * from ds_mds_tab -- Get the property from a object exec @iRetVal = sp_OAGetProperty @iObject, 'ExtraInfo_FromB', @sProperty OUT IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG2: Source: ' + @sSource + ' Description: ' + @sDescription print @sLog end print @sProperty -- Write it to the log exec ds_sp_writetodslogger 'ple', @sProperty waitfor delay '00:00:01.00' end
Hello, I forgot to poste one additional information: if I change the code like this: ----------------------------------------------------------- while @sProperty = '?' begin exec @iRetVal = sp_OAMethod @iObject,'SendNotification_FromA', @iProperty OUT, 555, @dDateEVT, @sText1, @sText2 exec @iRetVal = sp_OAGetProperty @iObject, 'ExtraInfo_FromB', @sProperty OUT IF @iRetVal <> 0 begin exec sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT set @sLog = 'LOG2: Source: ' + @sSource + ' Description: ' + @sDescription print @sLog end print @sProperty waitfor delay '00:00:01.00' end --------------------------------------------------------------- means,I call the method always before getting the property, after a while I change the value of property from side of object, I do get this value! The problem is, I cannot call the method more then one time. I mean, it is possible, but this is against the concept of the object. I must say, that I already posted similar post about the problems with sp_OA*, but at this Time I did that, there was another problem, and I solved it by my selfe, with help from you:-) Thank's in advice
Don't see what you're looking for? Try a search.
|