Active Directory 'lastLogon' time conversion
using system; using system.data; using system.directoryservices; using microsoft.sqlserver.dts.pipeline.wrapper; using microsoft.sqlserver.dts.runtime.wrapper; ... if (result.properties["lastlogon"] != null && result.properties["lastlogon"].count > 0) { long int64value = (long)((uint)result.properties["lastlogon"].lowpart + (((long)result.properties["lastlogon"].highpart) << 32)); output0buffer.lastlogon = datetime.fromfiletimeutc(int64value); } ...
hi murugan , cooldadtx
sorry late reply... somehow lost trace of topic...
unfortunately input didn't work... because use bi dev studio couldn't use newest visualstudio .net framework 4 seems neccessary use int64 reference...
i have had create new com component ore something, have lead further problems on deploying project on reporting server...
so made workaround... imported values string...
... if (result.properties["lastlogon"] != null && result.properties["lastlogon"].count > 0) { output0buffer.lastlogon = result.properties["lastlogon"][0].tostring(); ...
... , converted them afterwards via bigint and datetime2 on sql server following code:
update ... [lastlogon] = case when cast([lastlogon] as bigint) = 0 then null else convert(varchar(19),(dateadd(mi,(cast([lastlogon] as bigint) / 600000000) + datediff(minute,getutcdate(),getdate()),cast('1/1/1601' as datetime2))), 120) end, ...
that's it... anyways, appreciated help...
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment