DBConfigSection

Description

Specifies the section in a .NET configuration file to be used to specify custom configuration settings.

NoteWhen to specify DBConfigSection You must specify a value for DBConfigSection before connecting to the database.

Applies to

Syntax

DBConfigSection = 'value'

Parameter

Description

value

A string that specifies the section in a .NET configuration file to be used to specify DbParameter values and the syntax used to obtain the value of an identity column. The value is the name of a section you create in a .NET configuration file.

Default

None.

Usage

You can use the standard select @@identity syntax to obtain the value of an identity column. You can also use an alternative syntax, such as select scope_identity(), by adding sections to a .NET configuration file for your application.

The configuration file resides in the same directory as the application and has the same name as the application with the extension .config. It can contain multiple custom configuration sections. Each has two attributes: dbParm and getIdentity. You can set either or both of these attributes.

The dbParm value sets the value of the DbParameter parameter of the transaction object. It has a maximum length of 1000 characters. If you set a value for a parameter in the configuration file, any value that you set in code or in the Database Profile Setup dialog box is overridden.

The getIdentity value specifies the syntax used to retrieve the value of an identity column. It has a maximum length of 100 characters. If you do not specify a value for getIdentity, the select @@identity syntax is used.

For more information about creating the configuration file, see the chapter on ADO.NET in Connecting to Your Database.

Examples

Example 1

To specify that your DataWindow Designer application uses the custom configuration file called myconfig1:

This sample configuration file for DataWindow Designer 10is called dw20.exe.config. It contains three custom configurations. The <myconfig> element sets both the dbParm and getIdentity attributes. <myconfig1> sets getIdentity only, and <myconfig2> sets dbParm only.

<configuration>
   <configSections>
     <sectionGroup name="dbConfiguration">
        <section name="myconfig"          type="Sybase.PowerBuilder.Db.DbConfiguration,
         Sybase.PowerBuilder.Db, Version=10.0.9999,
         Culture=neutral,
         PublicKeyToken=9131e8bacdad8fb5"
        />
        <section name="myconfig1"
         type="Sybase.PowerBuilder.Db.DbConfiguration,
         Sybase.PowerBuilder.Db, Version=10.0.9999,
         Culture=neutral,
         PublicKeyToken=9131e8bacdad8fb5"
        />

        <section name="myconfig2"
         type="Sybase.PowerBuilder.Db.DbConfiguration,
         Sybase.PowerBuilder.Db, Version=10.0.9999,
         Culture=neutral,
         PublicKeyToken=9131e8bacdad8fb5"
        />
      </sectionGroup>
   </configSections>

   <dbConfiguration>
      <myconfig dbParm="disablebind=0"
       getIdentity="select scope_identity()" 
      />
      <myconfig1 getIdentity="select scope_identity()"
      />
      <myconfig2 dbParm=
       "Namespace='Oracle.DataAccess.Client',
       DataSource='ora10gen',DisableBind=0,
       NCharBind=1,ADORelease='10.1.0.301'" 
      />
   </dbConfiguration>
</configuration>