CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Connection String and Stored Procedures

Print topic Send  topic

Author Message
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

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.