DBConfigSection database parameter
Description
Specifies the section in a .NET configuration file to be used
to specify custom configuration settings.
When to specify DBConfigSection
You must specify a value for DBConfigSection before connecting
to the database.
Controls
-
ADO.NET
Syntax
|
1 |
DBConfigSection='<span>value</span>' |
|
Parameter |
Description |
|---|---|
|
value |
A string that specifies the section in |
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. For Web applications, add
the settings to the web.config file.
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
To specify that your PowerBuilder application uses
the custom configuration file called myconfig1:
-
Database profile
Specify myconfig1 in the ConfigSection Name in Configuration
File box on the System tabpage in the Database Profile Setup dialog
box. -
Application
Type the following in code:
1SQLCA.DbParameter="DBConfigSection='myconfig1'"
This sample configuration file for PowerBuilder is called pb125.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. The <runtime> section is in the configuration file
that ships with PowerBuilder but would not be included in the configuration
file that you ship with your application, which would have the same
name as your application with the extension exe.config.
For .NET Web Service targets, you add the custom configurations to
the web.config file. The <configSections> section
should be added before any other application settings.
|
1 |
<configuration><br>   <configSections><br>     <sectionGroup name="dbConfiguration"><br>        <section name="myconfig"          type="Sybase.PowerBuilderDataWindow.Db.DbConfiguration,<br>         Sybase.PowerBuilderDataWindow.Db"<br>        /><br> <br>        <section name="myconfig1"<br>         type="Sybase.PowerBuilderDataWindow.Db.DbConfiguration,<br>         Sybase.PowerBuilderDataWindow.Db"<br>        /><br>        <section name="myconfig2"<br>         type="Sybase.PowerBuilderDataWindow.Db.DbConfiguration,<br>         Sybase.PowerBuilderDataWindow.Db"<br>        /><br>      </sectionGroup><br>   </configSections><br> |
|
1 |
<runtime><br>      <assemblyBinding xmlns=<br>       "urn:schemas-microsoft-com:asm.v1"><br>         <dependentAssembly><br>            <assemblyIdentity name=<br>            "Sybase.PowerBuilder.Db"/><br>            <codeBase href="file:///C:/Program Files/<br>             Sybase/PowerBuilder 11.0/DotNET/bin/<br>             Sybase.PowerBuilder.Db.dll"/><br>         </dependentAssembly><br>         <dependentAssembly><br>           <assemblyIdentity name=<br>            "Sybase.PowerBuilder.WebService.WSDL"/><br>           <codeBase href="file:///C:/Program Files/<br>            Sybase/PowerBuilder 11.0/DotNET/bin/<br>            Sybase.PowerBuilder.WebService.WSDL.dll"/><br>         </dependentAssembly><br>         <dependentAssembly><br>           <assemblyIdentity name=<br>            "Sybase.PowerBuilder.WebService.Runtime"/><br>            <codeBase href="file:///C:/Program Files/<br>             Sybase/PowerBuilder 11.0/DotNET/bin/<br>             Sybase.PowerBuilder.WebService.<br>             Runtime.dll"/><br>         </dependentAssembly><br>         <probing privatePath="DotNET/bin" /><br>      </assemblyBinding><br>   </runtime> |
|
1 |
<br>   <dbConfiguration><br>      <myconfig dbParm="disablebind=0"<br>       getIdentity="select scope_identity()" <br>      /><br>      <myconfig1 getIdentity="select scope_identity()"<br>      /><br>      <myconfig2 =<br>       "Namespace='Oracle.DataAccess.Client',<br>       DataSource='ora10gen',DisableBind=1,<br>       NCharBind=1,ADORelease='10.1.0.301'" <br>      /><br>   </dbConfiguration><br></configuration> |