Solved

Connection

Posted on 2004-09-26
4
215 Views
Last Modified: 2010-04-15
Hi Experts,

I have error message : (same code and web.conf are used within other pages and works fine.)

The ConnectionString property has not been initialized


Code is :

SqlConnection sqlConnect = new System.Data.SqlClient.SqlConnection();
sqlConnect .ConnectionString = (string)Application["ConnectString"];
sqlConnect .Open();

Thank you.
0
Comment
Question by:fpoyavo
4 Comments
 
LVL 15

Expert Comment

by:Timbo87
ID: 12157624
Are you sure you're retrieving the right data? You can test it by copying and pasting the hard-coded connection string in. Obviously don't use this in the final product, but it will be OK for testing. If it works then your problem is with Application["ConnectString"] and if it doesn't then it's a problem with your connection string.
0
 
LVL 6

Expert Comment

by:Chester_M_Ragel
ID: 12158021
If you get that excaption, then surelly
 
sqlConnect .ConnectionString = null;

which means

(string)Application["ConnectString"] = null;

The problem may be with your config file, or something related with that.
0
 
LVL 10

Expert Comment

by:123654789987
ID: 12158301
AS Chester_M_Ragel pointed out Application["ConnectString"] = null.  U can test by harcoding the connection string in the program. If it works fine, then u can be sure the problem is with the config file.

The config file should be present in the calling assembly's project output folder, this can either be \bin or \bin\Debug according to the settings
0
 
LVL 3

Accepted Solution

by:
seazium earned 500 total points
ID: 12158940
hi fpoyavo  ..,
this article will help u to sort out ur prob  ..,
check it and me available her for ur help  ... ,,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtbstroubleshootingdataaccessinvisualstudionet.asp

--dZelters..
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now