Share via


IIS Samples - Database Transaction Component

The mtxsample sample shows how to perform a transaction. It involves multiple database updates using MTS/COM.

important Important These samples are provided for educational purposes only. They are not intended to be used in a production environment, have not been tested in a production environment, and Microsoft does not provide technical support for them.

Sample Overview
Requirements
Location of the Source Code
Build and Install the Sample
Run the Sample
Helpdesk

Sample Overview

The mtxsample sample is very similar to the old MTS SDK VC sample, but instead of using a VB application as the client, we use ASP as the client.

The component has three objects:

  • BankVC.Account
  • BankVC.CreateTable
  • BankVC.MoveMoney
to top

Requirements

This sample requires the installation of the following software to function properly:

  • Windows XP Professional with IIS 5.1 installed or Windows .NET Server with IIS 6.0 installed.
to top

Location of the Source Code

IIS samples are included in the IIS Software Developer Kit (SDK). You can download the IIS SDK from Platform SDK Update. You can view the SDK at MSDN Online. In the table of contents at MSDN Online, click Web Development, Server Technologies, Internet Information Services (IIS), SDK Documentation, Internet Information Services, Samples.

The following source code files are required for this sample:

File Description
MTXSample.sln MTXSample Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.
MTXSample.vcproj MTXSample Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.
MTXSample.dsp, MTXSample.dsw MTXSample Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.
Account.cpp, BankVC.cpp, CreateTable.cpp, MoveMoney.cpp, StdAfx.cpp Source modules containing the code that implements the sample.
BankVC.def, BankVCps.def DLL definitions containing code for creating the sample.
Account.h, CreateTable.h, MoveMoney.h, resource.h, StdAfx,h MTXSample header file containing commonly called routines.
BankVC.mak Sample makefile for command line compilation
MTXSample.asp Sample web files, required to illustrate how the sample file is used.
to top

Build and Install the Sample

To build this sample using the Visual C++ IDE, the following steps must be performed:

  1. Open the solution (VS.NET) or desktop (VS6) file to open the project.
  2. Click Build to create the DLL.

To build and run this sample without using the Visual C++ IDE, the following steps must be performed:

  1. Type NMAKE All from the command line. For example, if your sample files are located in a folder called C:\MySamples, type the following at the command line:
    cd /d c:\MySamples NMAKE BankVC.mak All
    

To install this sample, the following steps must be performed:

  1. Copy the DLL and ASP files to a physical folder on your computer. For example, create a folder called C:\Samples and copy the whatever_files to that folder.

  2. In Component Services Manager, under COM+ Applications, create a New Application. Select "Create an empty application" called IIS Sample, and select the "Library application" radio button.

  3. Under IIS Sample, right-click Components, New Component, "Install new component(s)". Enter the path to your BankVC.dll.

  4. Under IIS Sample, Components, right-click each object listed, select Properties, Transactions, and set the "Transaction support" as follows:

    BankVC.Account -> Required
    BankVC.CreateTable -> Requires New
    BankVC.MoveMoney -> Required

    Note: Asp provides a transaction by default. If you do not want this sample to use the transaction control provided by ASP, set the "Transaction support" for BankVC.MoveMoney to Requires New.

to top

Run the Sample

In order to run this sample, follow the instructions listed below:

  1. Browse to your sample Web files in Internet Explorer (IE). For example, if your files are in a virtual directory called MTXSample, type https://localhost/MTXSample/BankVC.asp in the Address bar of IE.
to top

Help Desk

If here you do not find answers to your questions, visit the Microsoft Help and Support Web site.

Problem Possible Solution
When browsing to the ASP page, IE returns HTTP 404 - File not found Verify that you have created a virtual directory of the same name you are typing in the Address box of IE....
When building the dll, C++ or VB returns the a permissions error. Once you have called the dll from your web page, your system considers it a loaded dll. You must unload it to build it again, either by unloading the ASP application or deleting the dll from system32\dllcache.
When building the dll, C++ returns a permissions error. Once you have called the dll from your web page, your system considers it a loaded dll. You must unload it to build it again, either by unloading the ASP application or deleting the dll from system32\dllcache.
When browsing to the dll, IE gives you a permissions error. The folder and virtual directory must have Execute permissions set on them.
to top