Stored procedure name in config file?

  • Thread starter Thread starter Gustaf
  • Start date Start date
G

Gustaf

Hi all,

I'm building a Web Service to INSERT records into an Oracle DB. For this I'm using a DataSet (.xsd) with a QueriesTableAdapter, to call a stored procedure for inserts in the Oracle DB. The connection string is stored in a configuration file (Web.Config) like so:

<connectionStrings>
<add name="conn_oracle" connectionString="Provider=MSDAORA;Data
Source=mydb;Password=mypwd;User ID=myuser"
providerName="System.Data.OleDb" />
</connectionStrings>

The name of the stored procedure is set in a wizard when you create the QueriesTableAdapter and it's then stored in the CommandText property. I would like to make this name configurable by storing in the configuration file too, like so:

<appSettings>
<add key="insert_command" value="myInsertStoredProcedureName"/>
</appSettings>

Is a there a way to get this value at run-time and use it in the query?

Gustaf
 
Hi all,

I'm building a Web Service to INSERT records into an Oracle DB. For this I'm using a DataSet (.xsd) with a QueriesTableAdapter, to call a stored procedure for inserts in the Oracle DB. The connection string is stored in a configuration file (Web.Config) like so:

<connectionStrings>
<add name="conn_oracle" connectionString="Provider=MSDAORA;Data
Source=mydb;Password=mypwd;User ID=myuser"
providerName="System.Data.OleDb" />
</connectionStrings>

The name of the stored procedure is set in a wizard when you create the QueriesTableAdapter and it's then stored in the CommandText property. I would like to make this name configurable by storing in the configuration file too, like so:

<appSettings>
<add key="insert_command" value="myInsertStoredProcedureName"/>
</appSettings>

Is a there a way to get this value at run-time and use it in the query?

Gustaf

Hi mate, I think the code goes something like in .NET 2.0 C#

ConfigurationManager.AppSetting["insert_command"].ToString()

Jon - NantwichOnline
http://www.nantwichonline.com/restaurants.aspx
 
Back
Top