ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Error: System.NullReferenceException Object reference not set to an instance of an object when connection string not defined in ASP.NetHi @kennr,<br />Please try the following<br /><br /><a href = 'link(Threads/173509/Need-some-example-on-how-group-by-clause-works-in-SQL-Server/)'>Need some example on how group by clause works in SQL Server</a><br /><br />It might help you.<br /><br />Cheers Andrea.https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/Sun, 29 Jan 2017 21:31:15 GMTError: System.NullReferenceException Object reference not set to an instance of an object when connection string not defined in ASP.Net<p>I appreciate the quick response but this reply is not quite what I needed.&nbsp; To start I need help getting the HTML example code to work.</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/Sun, 29 Jan 2017 21:41:19 GMTError: System.NullReferenceException Object reference not set to an instance of an object when connection string not defined in ASP.Net<p>An Update:</p> <p>After download from <a href="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=df4e1964-2677-490a-926a-468cb4bf959b.zip">http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=df4e1964-2677-490a-926a-468cb4bf959b.zip</a> .</p> <p>After Build in VS2010, I viewed (ran) the VB.aspx file in Browser.&nbsp; I got the following compiler error in VB.aspx.vb:<br /><br />Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.<br /><br />Source Error:<br /><br /><br />Line 13:&nbsp;&nbsp;&nbsp;&nbsp; End Sub<br />Line 14:&nbsp;&nbsp;&nbsp;&nbsp; Private Sub BindGrid()<br />Line 15:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString<br />Line 16:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using con As New SqlConnection(constr)<br />Line 17:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using cmd As New SqlCommand()<br /><br /><br />Source File: C:\...\VB.aspx.vb&nbsp;&nbsp;&nbsp; Line: 15</p> <p>Your helps are prreciated.</p> <p>&nbsp;</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/Sun, 29 Jan 2017 22:36:35 GMTError: System.NullReferenceException Object reference not set to an instance of an object when connection string not defined in ASP.Net<blockquote><cite>kennr says:</cite> <pre>Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString</pre> </blockquote> <p>&nbsp;You need to set the connection string in configuration section of your web.config like below </p> <pre class="brush: html">&lt;connectionStrings&gt; &lt;add name =&#34;constr&#34; connectionString=&#34;Server=xxxxx;DataBase=Test;UID=xxx;PWD=xxxx&#34; providerName=&#34;System.Data.SqlClient&#34; /&gt; &lt;/connectionStrings&gt;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/https://www.aspforums.net:443/Threads/239159/Error-SystemNullReferenceException-Object-reference-not-set-to-an-instance-of-an-object-when-connection-string-not-defined-in-ASPNet/Mon, 30 Jan 2017 04:59:53 GMT