CheckAccess datetime issue

May 18, 2010 at 12:57 AM


I'm having trouble getting the checkaccess method to work properly.  My code looks like this:

AuthorizationType auth = storage.CheckAccess("New Store", "Platinum", "Claims Processor", user, DateTime.Now, false); 

When I run this it is not picking up that I have access when I do.  I ran SQL profiler on the SQL server to see if the database was even getting hit and this is what I saw:

declare @p10 int
set @p10=0
exec dbo.netsqlazman_DirectCheckAccess @STORENAME=N'New Store',@APPLICATIONNAME=N'Platinum',@ITEMNAME=N'Claims Processor',@OPERATIONSONLY=0,@TOKEN=0x15000000,@USERGROUPSCOUNT=0,@VALIDFOR='2010-05-17 15:33:03.7200000',@LDAPPATH=N'RootDSE',@RETRIEVEATTRIBUTES=0,@AUTHORIZATION_TYPE=@p10 output
select @p10

This code gives me an error when I run it through sqlserver query analyzer.  It complains about not being able to convert a varchar to a datetime.  I removed the trailing 5 zeros in the time portion of the datetime data and the command then run through the query analyzer. Has anyone else experienced this problem?  The checkaccess method requires a datetime be passed, I'm not sure how to resolve this without ripping into the source code (which I'm currently working on).

This is SQL 2008, .net 4.0.

Thank you,


May 19, 2010 at 7:48 PM

I have resolved this, I had to change the input parameter on the DirectCheckAccess stored procedure to DateTime2(7). 

Jun 21, 2010 at 12:58 PM

Good job.

Andrea Ferendeles
NetSqlAzMan Project Coordinator
E-mail Web