473,586 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.pid Mess', @iObject OUTPUT,1
EXEC sp_OAGetErrorIn fo @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_OAGetErrorIn fo @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 1519
ma****@sauron.x o.pl (Matik) wrote in message news:<8b******* *************** ****@posting.go ogle.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.pid Mess', @iObject OUTPUT,1
EXEC sp_OAGetErrorIn fo @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_OAGetErrorIn fo @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****@sommarsk og.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
5976
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 a ocx developed my me use vc6,this ocx works fine in wxpython. but you can see i only change this ocx with a new DICOM ocx and set up eventClass,
7
2714
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 pass the ActiveX variable into my ASP script. My code is as follows. Thanks. ----------------- activeX code: (I have this saved as activeX.asp...
2
5016
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 object: Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
4
2700
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, buttons with a dll? Thanks.
0
1836
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 function picturebox_keydown in response to the keydown events on the ActiveX control. These can work well. But when I update these codes to vb.net I got...
0
1263
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 the older DLL). Now I want to raise an event in the wrapper and have VB.Net handle the event. Can anyone give me some direction on how to do this or...
3
8354
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 ActiveX Exe, I just can't seem to catch the event. I've declared my object as follows: <OBJECT ID = "Test3" CODEBASE =...
0
1585
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 event. But when I place the control in an Object tag on an ASPX page, and add my event handler in VBScript, I do not get the event. Its like the...
3
1853
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 server when hosted within a browser from anywhere.Originally we were planning on using port forwarding...and having the externalip:databaseport...
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.