Stored procedure name in config file?

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
 
J

Jon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top