Solved

Connection

Posted on 2004-09-26
4
213 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

17 Experts available now in Live!

Get 1:1 Help Now