Browsed by
Month: September 2013

Using ExecuteScalar to Populate a Variable in C#

Using ExecuteScalar to Populate a Variable in C#

After many attempts and various and sundry internet searchings, I have finally have properly working code to display the result of a scalar query in tSQL using asp.net C#. I had to add the reference to System.Configuration in Visual Studio. using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Configuration; Then I have this code in the PageLoad event of code behind: int addcount; //variable to hold my result string strConnection =…

Read More Read More