C# guid and SQL uniqueidentifier

Here’s a code snippet showing how to insert a GUID using a parameterised query: using(SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using(SqlTransaction trans = conn.BeginTransaction()) using (SqlCommand cmd = conn.CreateCommand()) { cmd.Transaction = trans; cmd.CommandText = @”INSERT INTO [MYTABLE] ([GuidValue]) VALUE @guidValue;”; cmd.Parameters.AddWithValue(“@guidValue”, Guid.NewGuid()); cmd.ExecuteNonQuery(); trans.Commit(); } }

Any way to identify browser tab in JavaScript?

SessionStorage is per tab/window, so you can define a random number in sessionStorage and get it at first if exists: var tabID = sessionStorage.tabID ? sessionStorage.tabID : sessionStorage.tabID = Math.random(); UPDATE: In some cases, you may have same sessionStorage in multiple tab (e.g. when you duplicate tab). In that case, following code may help: var … Read more