You have to set the name of the parameter (instead of g
) in the SqlCommand
. Something like:
SqlParameter user_GUID = new SqlParameter("@user_guid", SqlDbType.UniqueIdentifier);
user_GUID.Value = g;
SqlCommand cmdd = new SqlCommand("INSERT INTO u_security(user_guid) VALUES (@user_guid)", cn);
cmdd.Parameters.Add(user_GUID);