This program demonstrates how to use MS DTC in C++ using ODBC. It uses MS DTC to perform simultaneous updates on two SQL servers. The transaction in this example is client initiated. The client also initiates the commit operation.
Because this sample uses the ODBC interface, you'll need to configure ODBC data source names for two instances of SQL server to run this sample. Each data source name (DSN) must reference the pubs database in a separate instance of SQL Server. The authors table in the pubs database is used in this sample.
C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Msdtc\Odbc
Open odbc.dsw in Microsoft® Visual C++® 6.0 and compile this program. Make sure to do the following before compiling:
To run the sample, open a Command Prompt window, and then change the current directory to where sqlcurs.exe is located. Run the program by entering "odbc -h".