Cω - Reference

Cω SQL Generator (Sql2Comega.exe)

The Cω (Cω) SQL Generator can be used for importing metadata from a SQL Server database into a managed assembly which can then be used in a Cω project for writing code against that database.

Syntax

sql2comega /server:server /catalog:catalog [/module:module] [/namespace:namespace] [/userid:userid] [/password:password] [/source] [/trusted_connection]

Parameters

/server:server
The name of the SQL Server to use. (Required.)
/catalog:catalog
The name of the database to use. (Required.)
/module:module
The name of the managed assembly to generate. (Required.)
/namespace:namespace
The Common Language Runtime (CLR) namespace to use when importing and generating the library module with the SQL type information. This value will be used to prefix and qualify all of the generated types. (Required.)
/userid:userid
The user account on SQL Server to use. (Optional.)
/password:password
The name of the SQL Server to use. (Optional.)
/source
Generate source code as well as an assembly. (Optional.)
/trusted_connection
Use Windows authentication instead of userid and password when authentiicating the user to the SQL Server database. (Optional.)

Remarks

You can use the SQL Assembly Generator from within the Visual Studio development environment or from the command-line.

To use Cω SQL Generator at the command line

  1. Open a Cω command prompt window.

    To open a Cω command prompt window, from the Start menu, click Programs, point to Microsoft Cω Language, point to Tools, and then click Cω Command Prompt.

  2. Use the syntax and parameter details mentioned above to complete a sql2comega command line.

To use Cω SQL Generator from within Visual Studio

  1. Open or create a Cω project.
  2. In the Solution Explorer pane, select References.
  3. Right-click and select Add Database Schema and then provide SQL database connection information as follows:.
    • In Cω SQL Generator, for Enter a server name, enter the name of the server instance to use.
    • For authentication, select either Use Windows NT Integrated Security or Use a specific user name and password.
    • If you select Use a specific user name and password, also specify the SQL user ID for login and any password it requires for SQL authentication. Also you can select Allow saving password if you want Visual Studio to store and recall this information in the future.
    • Select the SQL database at the server to use and then click Next.
  4. On the Assembly tab, provide the following information about the assembly:
    • For Assembly name, enter the name of the library module to file to be generated.
    • For Namespace, enter the name of the CLR namespace you want to be used to add the types for the library you will be generating.
  5. Click Build to build the SQL type library module and then click OK.

    This will automatically generate the assembly in the same folder as your Cω project and add it to your list of referenced assemblies in the Solution Explorer pane. You can then proceed with using those new types when programming in Cω against the database.

To update a type library module using the Cω SQL Generator in Visual Studio

  1. Open your Cω project.
  2. In the Solution Explorer pane, select the assembly to be updated under References.
  3. Right-click and select Properties.

    This will bring up the same dialog box that was described in step 3 and later of the previous preocedure.

  4. Update any settings and repeat the process in steps 3 through 5 above to rebuild the assembly.
  5. Verify build results and then click OK to close the tool and return to your Visual Studio project window. The updated types will be automatically imported from the re-built assembly and the Intellisense will guide you from there.