Where to store DB connection string?

G

Guest

Hello, friends,

I have two questions:

(1) In asp.net, where is the best place to store DB connection string? (We
have .dll to handle all DB queries.)

(2) Any sample source code for client side calendar? (We tried web control
calendar. But, each time we selected a date/changed year or month, it would
go back to web server. It would increase a lot network traffic.)

Thanks a lot.
 
S

S. Justin Gengo

Andrew,

The best practices state to store the connection string in the appSettings
section of the web.config file.

I don't have a recommendation for a calendar, I hope someone else will be
able to steer you in the right direction for that.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Hello Dear Andrew,

Answer to your 1st Question
(1) In asp.net, where is the best place to store DB connection string? (We
have .dll to handle all DB queries.)

In the web.config just add the <appSettings></appSettings> in between
<configuration> and <system.web> like the following
<configuration>
<appSettings>

<add key="ConnectionInfo"
value="server=(local);database=Northwind;Integrated Security=SSPI" />

</appSettings>
<system.web>

give a Key Name for example I have given it as "ConnectionInfo" and the
value as your database details.

Thats all in the web.config.

In you code-behind file, to retrieve the Connection Info use
ConfigurationSettings.AppSettings

for example:

string connectionInfo = ConfigurationSettings.AppSettings["ConnectionInfo"];

using(SqlConnection connection = new SqlConnection(connectionInfo))

Try this one, It will work.

Reply to the 2nd Question, I will come back to you
(2) Any sample source code for client side calendar? (We tried web control
calendar. But, each time we selected a date/changed year or month, it would
go back to web server. It would increase a lot network traffic.)

bye
venkat_kl
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top