Hi
The most to define the database connection string so that it may excess in
every page by defining the string in Web.Config file.
<appSettings>
<add key="conStr" value="server=localhost;database=kk;user
id=sa;pwd=sa;Connection TimeOut=300;" /></appSettings>
Now to access this key in every page u have to include the System.Configuration
Namespace and then call
SqlConnection Con = new SqlConnection (
ConfigurationSettings.AppSettings.Get("conStr"));
Krishan Kant
Matthew Macdonald-Wallace <[EMAIL PROTECTED]> wrote:
Hi all,
I'm writing a webapp in C# and don't want to have to retype the same
code all over again for each database connection/login form etc.
What's the best way of including custom functions to do this?
cheers,
Matt
SPONSORED LINKS
Programming languages C programming language Computer programming languages
Java programming language C programming language History of computer
programming language
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "AspNetAnyQuestionIsOk" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Send instant messages to your online friends http://uk.messenger.yahoo.com
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/