473,242 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

Geting event from ActiveX into database

Hello everyone,

I was wondering. Is it possible, to recive an event from ActiveX into
database?
I was looking alredy with notification services, but I think that's
the wrong way.

Lets say, that there is a ActiveX which realize some tasks.
The database trigers the ActiveX like below:

================================================== =============

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

set @iObject = 0
set @dDateEVT = getdate()
set @iRetVal = 0
set @sText1 = '0000000000'
set @sText2 = '0000000000'
set @iProperty = 7

exec @iRetVal = sp_OACreate 'MComponent.pidMess', @iObject OUTPUT,1
EXEC sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT
IF @iRetVal <> 0
begin
set @sLog = 'LOG1: No object created. Source: ' + @sSource + '
Description: ' + @sDescription
print @sLog
end

-- Method
exec @iRetVal = sp_OAMethod @iObject,'Send_FromA', @iProperty
OUT,@nMessageNr = 5, @bstrDateTime = @dDateEVT, @textFromA1 = @sText1,
@textFromA2 = @sText2
EXEC sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT

IF @iRetVal <> 0
begin
set @sLog = 'LOG3: Source: ' + @sSource + ' Description: ' +
@sDescription
print @sLog
end

PRINT 'Property from method:'
PRINT @iProperty

================================================== =============

This function works properly. I recive the data into ActiveX.
After the ActiveX process the data, it returns the event, wit a
response for this call of method.

Now ... how do I can get, this event into SQL server?
Is it possible to do that enyhow, without acctions like:
- do, that the ActiveX writes the data in to a interface table, where
from it will be readed.

Any help would be appreciated

Mateusz
Jul 20 '05 #1
3 1505
ma****@sauron.xo.pl (Matik) wrote in message news:<8b**************************@posting.google. com>...
Hello everyone,

I was wondering. Is it possible, to recive an event from ActiveX into
database?
I was looking alredy with notification services, but I think that's
the wrong way.

Lets say, that there is a ActiveX which realize some tasks.
The database trigers the ActiveX like below:

================================================== =============

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

set @iObject = 0
set @dDateEVT = getdate()
set @iRetVal = 0
set @sText1 = '0000000000'
set @sText2 = '0000000000'
set @iProperty = 7

exec @iRetVal = sp_OACreate 'MComponent.pidMess', @iObject OUTPUT,1
EXEC sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT
IF @iRetVal <> 0
begin
set @sLog = 'LOG1: No object created. Source: ' + @sSource + '
Description: ' + @sDescription
print @sLog
end

-- Method
exec @iRetVal = sp_OAMethod @iObject,'Send_FromA', @iProperty
OUT,@nMessageNr = 5, @bstrDateTime = @dDateEVT, @textFromA1 = @sText1,
@textFromA2 = @sText2
EXEC sp_OAGetErrorInfo @iObject, @sSource OUT, @sDescription OUT

IF @iRetVal <> 0
begin
set @sLog = 'LOG3: Source: ' + @sSource + ' Description: ' +
@sDescription
print @sLog
end

PRINT 'Property from method:'
PRINT @iProperty

================================================== =============

This function works properly. I recive the data into ActiveX.
After the ActiveX process the data, it returns the event, wit a
response for this call of method.

Now ... how do I can get, this event into SQL server?
Is it possible to do that enyhow, without acctions like:
- do, that the ActiveX writes the data in to a interface table, where
from it will be readed.

Any help would be appreciated

Mateusz


I suspect this is not possible, since Books Online has no information
on event handling with the sp_OA% procedures. You should probably
consider using an external program or script to do what you need,
perhaps scheduled to poll a table on the server at intervals. I know
you mentioned that you're trying to avoid this, so if you need an
alternative approach you might want to give some more details of
exactly what you're trying to do, and why an "interface table" isn't a
good solution in your situation.

Simon
Jul 20 '05 #2
Thank you for reply.

Well... that's the problem. The ActiveX shouldn't be changed any more,
and that's why I have no possibility to implement a function in it,
which writes the data in to interface table. That's why I do not want
such a solution.

I do some algorithm in the database, and in one step, I must 'ask'
ActiveX, for data. This data are the condition for the next steps in the
algorithm from DB.
Now, via sp_OAx procedures, it is possible, to interact with this
ActiveX to give it the data. But the ActiveX do not respond immiedetly,
only via event. It is immposible, to change the ActiveX, that on event,
it writes the data back into DB. I have the solution, that I can have
another program, which catches the event from ActiveX and then writes it
back into DB (or a program which will be called from sp_OAx, and waits
internaly for the ActiveX so long, that as return value can give the
values recived from ActiveX). But these are solutions, which I use
reluctantly.

But anyway ... The solution with table, want be bad, but then I must
have a while loop, til I become answer. I would like not to implement
such a solution.

The best way, as I said, will be, to get the event directly (anyhow) in
to DB, with mechanics and solutions of SQL DB.

Mateusz

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Mateusz Marzec (ma****@sauron.xo.pl) writes:
Well... that's the problem. The ActiveX shouldn't be changed any more,
and that's why I have no possibility to implement a function in it,
which writes the data in to interface table. That's why I do not want
such a solution.

I do some algorithm in the database, and in one step, I must 'ask'
ActiveX, for data. This data are the condition for the next steps in the
algorithm from DB.
Now, via sp_OAx procedures, it is possible, to interact with this
ActiveX to give it the data. But the ActiveX do not respond immiedetly,
only via event. It is immposible, to change the ActiveX, that on event,
it writes the data back into DB. I have the solution, that I can have
another program, which catches the event from ActiveX and then writes it
back into DB (or a program which will be called from sp_OAx, and waits
internaly for the ActiveX so long, that as return value can give the
values recived from ActiveX). But these are solutions, which I use
reluctantly.


An event is essentially a callback, and T-SQL has no mechanism for this.
So if you can't change the COM module, you would have to write a wrapper
that reacts on the callback.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wang xiaoyu | last post by:
Hello: i want use activex in wxpython program,but when i use MakeActiveXClass an exception occurs. this is my source code dealing the DICOM ocx.I must note that in this program "hwtxcontrol" is...
7
by: Newbie | last post by:
Hi all, I have some activeX code that I use to get the local computer name. (I don't think this is possible using ASP from my research). The rest of my code is ASP. I'd like to know how to...
2
by: jva02 | last post by:
Hi, I'm confused why I can capture an event fired by an ActiveX object when it's loaded via an <object> tag, but not when loaded using "new ActiveXObject". Here's a basic example: vb ActiveX...
4
by: rufus | last post by:
Hi, On the project I am working on we need to encapsulate all data and business logic in an activex dll. My question is: How do I do this? How can I access the form objects ie text boxes,...
0
by: Peter | last post by:
I have a VB6 program which can receive Keydown events on an ActiveX control. The ActiveX control can't fire keydown events so I put a picturebox below the ActiveX control. I write codes in...
0
by: Tom Edelbrok | last post by:
I have a VB6 ActiveX DLL wrapper around a 32-bit DLL (therefore forming my own totally new DLL). This permits VB.Net to make calls to the new DLL (whereas VB.Net always failed when making calls to...
3
by: Chad Johnson | last post by:
I know this question has been asked a million times but I still can't get an event from an embedded ActiveX Exe to be caught in javascript. I am able to access all the properties and methods of the...
0
by: Lee | last post by:
I have an activex control built with VS 2005, C#. I have a "Done" event that I fire from the control when some processing is done. I have tested this with a C++ app as the host, and I do get the...
3
by: tuvman | last post by:
We are developing a web application. Our web app is a heavy client- our existing .net app exposed as an activex control running in IE. We need the activex to be able to access our remote database...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.