Browsed by
Tag: tSql

Granting Permissions Based on AD User Group Membership

Granting Permissions Based on AD User Group Membership

After several different trial and error expeditions, I finally have a working PageLoad event to check whether the currently logged in user is a member of a specific group in Active Directory. The first step I used was a stored procedure to get a list of the user’s groups in Active Directory. We needed this for another project and I just reused it for this one. USE [master] GO /****** Object: StoredProcedure [dbo].[GetLdapUserGroups] Script Date: 11/18/2013 11:58:14 ******/ SET ANSI_NULLS…

Read More Read More

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