ADO.NETFor discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Up till now I've been creating my data connection within my .net pages or web service but would like to have one common place for all connections. How can this be accomplished.
Do you want a place to store the connection string? Are you looking to connect and maintain a single connection object that all parts of a page will use? Or do you want just centralize where/how you handle data? There are several different techniques depending on what your needs/desires are.
Peter
------------------------------------------------------
Work smarter, not harder.
YOU CAN STORE THE CONNECTION STRING IN WEB.CONFIG FILE
EXAMPLE
<appSettings>
<add key="connectionString" value="server=IP;uid=USERNAME;pwd=***;database=DB" />
</appSettings>
AND YOU CAN CALL ON *.ASPX
...................
String cn=ConfigurationSettings.AppSettings["connectionString"];
SqlConnection con =new SqlConnection(cn);