精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
How to get current logged in user info of dnn using Stored Procedures in Sql Server?
如何使用存储过程获得当前登录的DNN用户信息,这些信息会保存在SQL服务器上?
Solution1 解决方法1
Use this code to see what happens.
使用这一个代码看看会发生什么情况。
SELECT SUSER_NAME()
Solution2 解决方案2
Check the following Database Trigger Script.
检查下面的数据库触发器脚本。
CREATE TRIGGER [DDLTrigger_Sample] ON DATABASE FOR CREATE_PROCEDURE, ALTER_PROCEDURE,DROP_PROCEDURE AS BEGIN SET NOCOUNT ON; DECLARE @EventData XML = EVENTDATA(); DECLARE @ip VARCHAR(32) = ( SELECT client_net_address FROM sys.dm_exec_connections WHERE session_id = @@SPID ); INSERT AuditDB.dbo.DDLEvents ( EventType, EventDDL, EventXML, DatabaseName, SchemaName, ObjectName, HostName, IPAddress, ProgramName, LoginName ) SELECT @EventData.value('(/EVENT_INSTANCE/EventType)[1]', 'NVARCHAR(100)'), @EventData.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'NVARCHAR(MAX)'), @EventData, DB_NAME(), @EventData.value('(/EVENT_INSTANCE/SchemaName)[1]', 'NVARCHAR(255)'), @EventData.value('(/EVENT_INSTANCE/ObjectName)[1]', 'NVARCHAR(255)'), HOST_NAME(), @ip, PROGRAM_NAME(), SUSER_SNAME(); END
Get DOTNETNUKE Current User info Using Stored Procedures Is not difficult, we can try to solve the above two methods. note:(Step stored procedure: create a stored procedure, execute, delete stored procedures, modify the stored procedure.)
使用存储过程获取DotNetNuke当前用户信息并不困难,我们可以尝试使用上述两种方法。注意:(存储过程的步骤:创建存储过程、执行、删除存储过程、修改存储过程。)