Object reference not set to an instance of an object

Aug 5, 2007 at 6:16 PM
Hi,
I don't know, how to set a connection string. JMDCMS is in Virtual Directory named CMS, user is DB Owner and DSN is named SQL2005. I tried connection string:
<add name="CMS" connectionString="Data Source=SQL2005;Initial Catalog=CMS;User ID=user;Password=password" providerName="System.Data.SqlClient"/>
but i got an Error with this Stack trace>

Stack Trace:


NullReferenceException: Object reference not set to an instance of an object.
Util.SqlConnectionString() +22
Default.PageLoad(Object sender, EventArgs e) +48
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Could You help me, please?
Coordinator
Aug 6, 2007 at 3:26 AM
Edited Aug 6, 2007 at 3:29 AM
Dear Zdenek,

Correct connection string should look like this:

<add name="JMDCMS" connectionString="Data Source=SQL2005;Initial Catalog=CMS;User ID=user;Password=password" providerName="System.Data.SqlClient"/>

  1. Name should always be JMDCMS
  2. Data Source = SQL Server instance name. This is usually the computer name where your SQL Server 2005 is installed with default instance. Verify your SQL Server instance name by using SQL Server Management studio.
  3. Initial Catalog = Databse name i.e. CMS

Feel free to contact me for further assistance.

Happy Coding!





Aug 6, 2007 at 6:51 AM
Thank you, your answer was helpfully.