Hello, I had this working a few months ago but i cant read back a session variable set
in code but i can in the query analyzer..
this C# code sets the variable
String.Format("EXEC sp_set_session_context N'TENANTID', '{0}'", tenantId); SPSDatabaseInfo.ExecuteScalar(SPSDatabaseInfo.DBType.MSSQLServer, _connString, sql, null);
but when i read it back immediately with
sql = "select SESSION_CONTEXT(N'TENANTID') AS SESSION_ID"; var retVal = SPSDatabaseInfo.ExecuteScalar(SPSDatabaseInfo.DBType.MSSQLServer, _connString, sql, null);
it comes back null but i can set and read it no problem in the management studio
All comments welcome!
Andy