Building C# .NET applications

Db2® products provide a bldapp.bat batch file for compiling and linking Db2 C# .NET applications. This batch file is located in the sqllib\samples\.NET\cs directory along with sample programs that can be built with this file. The batch file takes one parameter, %1, for the name of the source file to be compiled (without the .cs extension).

About this task

This task will take you through the basic steps of building a C# .NET application using bldapp.bat with the DbAuth sample file.

Procedure

To build the program, DbAuth, from the source file, DbAuth.cs, enter:
bldapp DbAuth
To ensure you have the parameters you need when you run the executable, you can specify different combinations of parameters depending on the number entered:
  1. No parameters. Enter just the program name:
       DbAuth
  2. One parameter. Enter the program name plus the database alias:
       DbAuth <db_alias> 
  3. Two parameters. Enter the program name plus user ID and password:
       DbAuth <userid> <passwd>
  4. Three parameters. Enter the program name plus the database alias, user ID, and password:
       DbAuth <db_alias> <userid> <passwd>
  5. Four parameters. Enter the program name plus server name, port number, user ID, and password:
       DbAuth <server> <portnum> <userid> <passwd>
  6. Five parameters. Enter the program name plus database alias, server name, port number, user ID, and password:
       DbAuth <db_alias> <server> <portnum> <userid> <passwd>

What to do next

To build and run the LCTrans sample program, you need to follow more detailed instructions given in the source file, LCTrans.cs.