473,503 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Shared db update between VB.NET and VB6

I am converting a project from VB6 to VB.NET which has hundreds of plug-in
DLLs that perform various tasks on the application database. In order to
allow us to use the .NET version of the application without first having to
convert all of the plug-ins, I am planning to allow the application to call
into the existing COM plug-in DLLs.

The DLLs expect an ADO (classic) connection to be provided to them before
their main method is called so that they can read and write the database.
When calling, the main application begins a transaction, calls into the DLL,
then makes some database updates itself and commits the transaction. If
anything goes wrong the transaction can be rolled back and everything is
undone.

The VB.NET version of the application is using ADO.NET to access the
database. I'm therefore unable to pass the application's connection to the
COM plug-ins as they won't recognise it. I am planning to open a second
connection using ADO classic and pass this to the plug-ins.

However, this means that I cannot put a single transaction around the
updates performed by both the application and the plug-in (as each is a
separate connection). If one should fail after the other has been committed,
I have lots the integrity of my data.

Can anyone suggest any approaches to dealing with this situation to minimise
(or hopefully eliminate) this problem?

Many thanks,

--

(O) e n o n e
Nov 21 '05 #1
7 1346
Hi,

Create a webservice to update the database that you use with vb6 or
vb.net

http://www.dotnetspider.com/technology/kbpages/898.aspx

Ken
----------------------
"Oenone" <oe****@nowhere.com> wrote in message
news:mi**************@newsfe2-gui.ntli.net...
I am converting a project from VB6 to VB.NET which has hundreds of plug-in
DLLs that perform various tasks on the application database. In order to
allow us to use the .NET version of the application without first having to
convert all of the plug-ins, I am planning to allow the application to call
into the existing COM plug-in DLLs.

The DLLs expect an ADO (classic) connection to be provided to them before
their main method is called so that they can read and write the database.
When calling, the main application begins a transaction, calls into the DLL,
then makes some database updates itself and commits the transaction. If
anything goes wrong the transaction can be rolled back and everything is
undone.

The VB.NET version of the application is using ADO.NET to access the
database. I'm therefore unable to pass the application's connection to the
COM plug-ins as they won't recognise it. I am planning to open a second
connection using ADO classic and pass this to the plug-ins.

However, this means that I cannot put a single transaction around the
updates performed by both the application and the plug-in (as each is a
separate connection). If one should fail after the other has been committed,
I have lots the integrity of my data.

Can anyone suggest any approaches to dealing with this situation to minimise
(or hopefully eliminate) this problem?

Many thanks,

--

(O) e n o n e

Nov 21 '05 #2
Ken Tucker [MVP] wrote:
Create a webservice to update the database that you use with
vb6 or vb.net


Hi Ken,

My application is entirely WinForms based, so a webservice isn't relevant to
me. I'm also not sure how it would help with reducing transaction problems
between the two connections..?

Any other suggestions?

--

(O)enone
Nov 21 '05 #3
Oenone,

My application is entirely WinForms based, so a webservice isn't relevant
to me. I'm also not sure how it would help with reducing transaction
problems between the two connections..?

A webservice is for a winform application.

See this great walkthrough
http://msdn.microsoft.com/library/de...alkthrough.asp

I hope this helps,

Cor
Nov 21 '05 #4
On Mon, 21 Mar 2005 22:56:18 GMT, "Oenone" <oe****@nowhere.com> wrote:

¤ I am converting a project from VB6 to VB.NET which has hundreds of plug-in
¤ DLLs that perform various tasks on the application database. In order to
¤ allow us to use the .NET version of the application without first having to
¤ convert all of the plug-ins, I am planning to allow the application to call
¤ into the existing COM plug-in DLLs.
¤
¤ The DLLs expect an ADO (classic) connection to be provided to them before
¤ their main method is called so that they can read and write the database.
¤ When calling, the main application begins a transaction, calls into the DLL,
¤ then makes some database updates itself and commits the transaction. If
¤ anything goes wrong the transaction can be rolled back and everything is
¤ undone.
¤
¤ The VB.NET version of the application is using ADO.NET to access the
¤ database. I'm therefore unable to pass the application's connection to the
¤ COM plug-ins as they won't recognise it. I am planning to open a second
¤ connection using ADO classic and pass this to the plug-ins.
¤
¤ However, this means that I cannot put a single transaction around the
¤ updates performed by both the application and the plug-in (as each is a
¤ separate connection). If one should fail after the other has been committed,
¤ I have lots the integrity of my data.
¤
¤ Can anyone suggest any approaches to dealing with this situation to minimise
¤ (or hopefully eliminate) this problem?

I don't see how you can share the transaction space between the managed and unmanaged code for you
application unless you perform the transactions at the server level.

Another option might be to use COM+. I don't know the full details of your implementation but you
may be able to enable COM+ to handle the transaction for both your VB 6.0 and VB.NET components.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #5
Oenone,
In addition to Ken's suggestion.

I would consider using the Adapter Pattern to define a set of proxy classes
that implement the ADO interfaces, where the proxy classes use ADO.NET
internally to implement the ADO methods used by the COM plug-ins.

Then pass these Adapter objects to the COM plug-ins.

The "problem" with this method is that most people (me included) create
ADODB.Recordset & other ADODB objects directly, rather then indirectly via
Connection.Execute.

My other concern is how much effort this would be. However with hundreds of
COM plug-ins it may be worth it...

Hope this helps
Jay
"Oenone" <oe****@nowhere.com> wrote in message
news:mi**************@newsfe2-gui.ntli.net...
I am converting a project from VB6 to VB.NET which has hundreds of plug-in
DLLs that perform various tasks on the application database. In order to
allow us to use the .NET version of the application without first having
to
convert all of the plug-ins, I am planning to allow the application to
call
into the existing COM plug-in DLLs.

The DLLs expect an ADO (classic) connection to be provided to them before
their main method is called so that they can read and write the database.
When calling, the main application begins a transaction, calls into the
DLL,
then makes some database updates itself and commits the transaction. If
anything goes wrong the transaction can be rolled back and everything is
undone.

The VB.NET version of the application is using ADO.NET to access the
database. I'm therefore unable to pass the application's connection to the
COM plug-ins as they won't recognise it. I am planning to open a second
connection using ADO classic and pass this to the plug-ins.

However, this means that I cannot put a single transaction around the
updates performed by both the application and the plug-in (as each is a
separate connection). If one should fail after the other has been
committed,
I have lots the integrity of my data.

Can anyone suggest any approaches to dealing with this situation to
minimise
(or hopefully eliminate) this problem?

Many thanks,

--

(O) e n o n e

Nov 21 '05 #6
It's not guaranteed data-integrity, but if it's possible/feasible from
ADO.NET use a two-stage commit and if you DB supports it:
ADO.NET => prepare to commit (stage 1)
ADO => Commit

If success(ADO Commit)
ADO.NET => Commit (stage 2)
else
ADO.NET => Rollback

Nov 21 '05 #7
Oenone wrote:
However, this means that I cannot put a single transaction around the
updates performed by both the application and the plug-in (as each is
a separate connection). If one should fail after the other has been
committed, I have lots the integrity of my data.


I actually found the answer I was looking for in the end, but it turned out
to be a SQL Server problem rather than ADO.NET.

The solution is to use bound connections (sp_bindsession). This allows two
separate connections (one in ADO.NET and the other in ADO) to share the same
transaction. They will therefore not block one another, and all updates can
be committed in a single atomic operation.

--

(O) e n o n e
Nov 21 '05 #8

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

Similar topics

3
2117
by: alanrn | last post by:
I would like to start a dialog on how to implement the equivalent functionality of UNIX shared memory in .NET. I work with a factory automation system. The bulk of the system is written in C/C++....
2
1407
by: jfathman | last post by:
Hello, We are considering a project that requires implementing a database (Windows PC based) that would be shared by a small number of users. The database would store events output by our...
3
3695
by: Frank | last post by:
We have an Access database Sch_S.mdb in the shared driver S across the network. I have a copy of that database in my local driver C, named as Sch_C.mdb. As per users' request I added some check...
9
4163
by: Invalidlastname | last post by:
Hi, We developed some assemblies which use EnterpriseServices queued components. In order to use EnterpriseServices, these assemblies need to be installed into GAC. I used the pre-build and...
14
6288
by: Joe Fallon | last post by:
I am trying to build a Data Access Layer for a SQL Server back end. My class has a number of methods in it. The constructor takes a connection string. I currently have to instantiate an object...
5
4379
by: Confused ! | last post by:
I am writing an ASP.NET application and I want to use shared members on the data layer to retreive information from the SQL Server. If I declare a Function to be Shared, how will this affect...
7
2817
by: nass | last post by:
hi all, i am running slackware linux and need to use some function that will will enable me to write and read from a shared mem segment.. i am using open() , to open a file, and then use mmap to...
21
8349
by: llothar | last post by:
Hello, i need to manage a heap in shared memory. Does anybody know about a portable (win32+mac+posix) c implementation for this.
0
866
by: Clay Hobbs | last post by:
On Fri, 2008-08-01 at 14:41 -0700, Zach Hobesh wrote: You could just give the script and the module to the other people who use your script, and tell them to put the files in the same directory....
16
3369
by: MA | last post by:
Hi, We have added a shared assembly in GAC so that our multiple solutions can use use it. We use the publisher policy to controls the different versions of the assembly. This shared assembly...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
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,...
1
6998
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...
0
7464
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...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.