Home |
Get/Set current UserID |
Getting started
|
Use DataInterface.SetCurrentUserID, as demonstrated in the following code sample. For more information, see the documentation.
using (SqlConnection conn = new SqlConnection(strConnectionString))
{
conn.Open();
DataInterface.SetCurrentUserID(conn, UserID);
//Perform your command here
}
Use the procedure SetCurrentUserID, and the function CurrentUserID, as demonstrated in the following code sample.
--Set UserID
exec SetCurrentUserID @UserID
--Find UserID
SELECT dbo.CurrentUserID()