Solved

Connection

Posted on 2004-09-26
4
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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