TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
सौरभ माहेश्वरी
NA
181
15.9k
How i Define Connection String in any class file
Jun 8 2015 3:11 AM
Dear Sir/Mam
Please tell me how can i define connection string in my class file.i do not want to describe it in web.config for Database Security.
//SqlConnection mainConnectionString = new SqlConnection();
string str = "server=192.1.1.1;database=db;user id=sa;password=.com;";
SqlConnection mainConnectionString = new SqlConnection(str);
// mainConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
// mainConnectionString.ConnectionString=("server=192.1.1.1;database=db;user id=sa;password=.com;").ToString();
string sam =Convert.ToString( mainConnectionString);
i use all this thing but project not working but if use
// mainConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
ConnectionString from web.config
then its working fine.
please tell me how i solve this problem or any alternative to secure dB USER and password.
or any decrypt or encrypt method use for web.config.
Reply
Answers (
5
)
DataGridView Delete Problem
asp.net c#