Introduction

Within the scope of Provisioning and Workflow, group management makes part of the Microsoft Identity & Access Management Series solution accelerator.
At the same page you’ll find a download link.

Originally the solution was shipped to support MIIS 2003 (.NET Framework 1.1).

With the upgrade/update to ILM 2007 (MIIS 2003 SP2) the Group management solution had to be upgraded to .NET Framework 2 before it could be used.
Keith Crosby documented the procedure very well on his blog (The Crosby Blog: Using the Group Populator application with ILM 2007 FP1).

An important addition to Keith’s procedure is that you better add the Web designer component to Visual Studio before you start converting and compiling the solution.

Regional settings dependency

 

When you use the en-us regional settings, you'll probably never have a problem with the group populator setup.

But when you change the serer regional settings, code page, language settings, the group populator might crash.
(I've running deployments with
EN-UK,  NL-BE, NL-NL, FR-BE combinations...
Except for some non-critical warnings, the solution will rebuild without problems.

But running the group populator might result in an error message: “Error btnAddRow_Click: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated.

image
Also other buttons and selections, resulted in the same error:

  • Error btnSave_Click:
  • Error btnAddRow_Click:
  • Error dgGroupDefinitions_DeleteCommand:

Every time with the same error body : “The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated”.
After some intensive troubleshooting, the error seemed to be coming from the underlying SQL Server, which had a problem with the time format that was written into the database.
But finally, the group management web application itself was the source of the trouble and the key to the solution.
 
In different places of the code, a time stamp is written to the database using the (VB.NET) date.now function.
But without formatting the result of that function can vary depending the system settings….
And if that format doesn’t match the date/time format SQL expects, you’re in trouble.

 

How to solve this?

 

1. In every page within the solution, which is using the date.now statement: add the “Imports System.Globalization” call on top. That allows to use the culture info, like 

 

/../

'/////////////////////////////////////////////////////////////////////////////

Imports System.Data.SqlClient

ImportsSystem.Diagnostics 

Imports System.Globalization

 

Namespace gp

 

/../

 

2. Change the date.now code definition to  Date.Now.ToString(CultureInfo.CurrentUICulture), when it's used to compose SQL statements, like

 



More info on CultureInfo.CurrentCulture and CultureInfo.CurrentUICulture.
Repeat this procedure for the GroupPopulator.exe solution.

But be careful. Only replace the date references in the composition of the SQL statements.
The grouppopulator.exe solution also uses a date variable (theCurrentTime) to store the date.now.
Leave the original declaration (Dim theCurrentTime As Date = Date.Now), because you can't put a string in a date type variable...

But you should add the string conversion for that variable when it's used in the SQL statement composition.
eg. theCurrentTime -> theCurrentTime.ToString(CultureInfo.CurrentUICulture)

hit counter