Dennis Ouellette
|
| Posted: 08/21/2002, 5:42 AM |
|
Hello,
I used CodeCharge to develop ASP.NET pages using C#. All works just fine. The question I have is this. I added some Stored Procedures in my code using a connection string I embedded in the files but this is going to become a maintenance nightmare. How can I use or take advantage of the one connection string that CodeCharge produced in the web.config file for the CodeCharge generated files in my Stored procedures? Here is my example:
SqlCommand myCommand;
SqlParameter myParameter;
SqlConnection _con = new SqlConnection ( _conString );
// _conString is declared at the top of the page
myCommand = new SqlCommand ("Log_BT_Delete", _con);
myCommand.CommandType = CommandType.StoredProcedure;
myParameter = myCommand.Parameters.Add(new SqlParameter("@bt",SqlDbType.VarChar, 50));
myParameter.Direction = ParameterDirection.Input;
myParameter.Value = (tblBaseTool1_BaseToolID.Text).Trim();
_con.Open();
myCommand.ExecuteNonQuery();
_con.Close();
I apperciate the help.
Thanks
Dennis
|
|
|
 |
Ken Hardwick
|
| Posted: 08/21/2002, 6:53 AM |
|
Dennis,
You might consider using functions...
see my article at...
http://www.gotocode.com/art.asp?art_id=149&
|
|
|
 |
Dennis Ouellette
|
| Posted: 08/21/2002, 7:49 AM |
|
Ken,
This article is superb if you are using ASP and VB but does not translate so easily using C# and ASP.NET. Of course, I could be missing the boat 
Thanks again!
Dennis
|
|
|
 |
|