Use COM + in C # To implement transaction control wirte (original)
Keyword c #, com +, transaction control
Use COM + in C # To implement transaction control
. NET technology is the next-generation platform technology that Microsoft vigorously promotes. Since the formal release of. NET Technical Architecture Beta2, this technology has gradually become mature and stable. According to Microsoft's platform system share, we can easily imagine that in the next year or two. NET technology is bound to become a mainstream technology platform, and the most important premise for a new technology platform to develop rapidly is: he will not abandon the previous technology completely, this is true. NET technology refers to the COM/COM + technology.
In general, in the IT technology field and hardware industry, the technology upgrading speed is amazing, and the practice is that all new technologies will follow the principle of backward compatibility,. NET technology does not only achieve this ,. NET and even implement their respective calls, which is very valuable. That is to say, we can not only call the COM component in the. NET component, but also call the. NET component normally in the COM component. The benefits of this point are obvious. On the one hand, we can maintain the existing technical resources, and on the other hand, we can use various new technologies brought about by. NET in the existing resources.
General database transaction control requires that the operations performed in the transaction must be performed in the same database so that RllBack can be rolled back to the initial State when an error occurs. This is a problem. In distributed applications, we often need to operate multiple databases at the same time and use the transaction processing of the database itself, which is difficult to meet the transaction control requirements of the program. COM + provides a complete transaction service, which can be used to control transactions in distributed applications.
The procedure is as follows:
1. Use VS. NET to generate a class library.
2. Add a reference to System. EnterpristServices. Detailed steps
Menu: (Project-add reference-on the. NET tab, select System. EnterpristServices-OK)
Iii. Build class
1: source program
Using System;
Using System. EnterpriseServices;