I am trying to execute the following but getting an error because the session is in a string format. I don't see a way to convert it to a unique identifier.
using (SqlConnection objConnection = new SqlConnection(strConnection))
{
using (SqlCommand objCommand = new SqlCommand("MyInsertCommand", objConnection))
{
objCommand.CommandType = CommandType.StoredProcedure;
objConnection.Open();
objCommand.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = (string)(Session["LoginID"].ToString());
objCommand.Parameters.Add("@Identity", SqlDbType.Int, 0).Direction = ParameterDirection.Output; // Having the variable @Identity set in the SQL insert command, we can get it back in the next sequence
objCommand.ExecuteNonQuery(); ...
Go to the complete details ...