.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unequal operator with GUID

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :Sql Server


Trying to create a conditional split on GUID. As simple as GUID1 != GUID2. According to BOL this is supported:


The expression set, expression1 and expression2, must follow one of these rules:


- GUID. Both expression1 and expression2 must evaluate to the DT_GUID data type.

(End quote)

However, when I do this, I get yhe following message:

(Qoute) The data type "DT_GUID" cannot be used with binary operator "!=".

(End quote)

So, in BOL it's explicitly possible, the error message says not. Of course I can work around it by converting to string, but I need to use this pretty often and would prefer not to convert to string every time. What's the story here?

BTW, I am on 64-bit SQL.

Regards, Pipo

View Complete Post

More Related Resource Links

Error: Encountered multiple versions of the same assembly with GUID...try pre-importing...TlbImp


Hi!  Can someone tell me how I can troubleshoot the following error: "Encountered multiple versions of the same assembly with GUID...try pre-importing one of these assemblies".

The website developed in VS 2010 (.Net 3.5). This error is only received on my workstation.  Another person developing the site does not experience this issue at all.  Also, not sure if this matters, but on my workstation the 'Assembly Information...' dialog contains no values even though the 'AssemblyInfo.vb' file does specify values for the title, desc, etc.  The GUID being referenced in the error is the main project of the three projects within the solution.

I tried looking through the GAC, but do not see any references to the projects or DLLs in the VS solution and am not sure what else/where to look.

If I delete the copy of the solution on my local machine and pull down a copy from source control (AnkhSVN) the solution will build with no error.  Once I make any changes, such as adding a new aspx file, then the error is received.

I can provide any additional information needed.

Advanced Basics: Revisiting Operator Overloading


On the conference circuit recently, I was speaking about some of my favorite new features in the Microsoft® . NET Framework 2. 0, using the content of three recent columns in this series as fodder. In my talk I sped through generics, operator overloading, and the BackgroundWorker component, all in the space of an hour (for the columns, see Advanced Basics: Being Generic Ain't So Bad, Advanced Basics: Calling All Operators, and Advanced Basics: Doing Async the Easy Way).

Ken Getz

MSDN Magazine September 2005

Want to create Page URL rewrite based on Users GUID and Display name?



I am using the asp.net membership. 

On my site I have a Profile.aspx page.

In the code behind of this page,  i get the logged in UserId (Guid) and pass

this to a method in my DAL. GetUserByUserId()


In my database I have a Table called Member which the method gets the data from

and displays details on the page about  the user.


What I want to happen is when they have logged in and are diverted to Profile.aspx,

the page URL shows www.MyWebSite/Profile/UsersName 

for example



is this possible. In my Member table I have FirstName and LastName columns or do I get the

name from the membership table.


even better would be they go straight to www.MyWebsite/JohnSmith.aspx


thank you for any help






Failed to convert parameter value from a String to a Guid.


I am trying to get the UserRole from the logged in user and send it to the database table my code is:

SqlParameter FamilyFriendsOther = new SqlParameter("@Role", SqlDbType.UniqueIdentifier);
        string [] roles = System.Web.Security.Roles.GetRolesForUser();
        if (roles.Length > 0)
            FamilyFriendsOther.Value = roles[0];

Syntax error (missing operator) in query expression

Good Day Gurus!

I have a Excel user application which has a user form (named 'Registo') that displays criteria and an image that has been entered in it's corresponding spreadsheet. This works the way it should.  There's also the ability to search the spreadsheet via a form (by clicking 'Pesquisar' button) this opens a search form. However, I having a bit of a problem with it. When I try to search for something it basically doesn't do anything at all. It just sits there. So I tried to debug it and I think I'm having a problem with either the JET db engine or somethign with teh query or maybe I don't have the correct reference.

I 'borrowed' this Excel application from another forum because it's exactly what I'm looking for! However, I suck at vb.

So I was hoping somebody could take a look at the code and see if I'm missing something?  I'm kinda' desparate to get this working because I'm been trying to figure it out for days and I'm running out of time.  Cry
Option Explicit

'constantes para auxiliar na verificação do código
Private Const Ascendente As Byte = 0

Gridview, guid ID, and Location


Presently I have a gridview, I'm in the process of populating the gridview. One colunm "Location" is displayed as the guid ID.  I need for that colunm to be displayed as the location. Here some of the code to display the grid.

myObject orgs = new myObject();
grid.DataSource = orgs;


orgs gets a list of organizations (locations) for the grid. How can I replace the guid ID with it location. Yes the guid ID and location are in a table.

GridView Paging + Unsupported overload used for query operator 'Distinct'


The issue is two fold in my ASP.NET Web Application. I need to use a custom Distinct() via LINQ to SQL, and then assign thevar as a DataSource to a GridView. If I use the custom Distinct that implements IEqualityComparer, I get "Unsupported overload used for query operator 'Distinct'" exception. but if i somehow get past this, i get "The data source does not support server-side data paging" exception on GridView.DataBind(). here is the code:

distinct_employees =
    (from emp in wsq.LIT_Active_Employees
    where (String.IsNullOrEmpty(ssFirstName.Text) ? (emp.FIRST_NAME == null || emp.FIRST_NAME.StartsWith(String.Empty)) : emp.FIRST_NAME.Contains(ssFirstName.Text)) &&
            (String.IsNullOrEmpty(ssLastName.Text) ? (emp.LAST_NAME == null || emp.LAST_NAME.StartsWith(String.Empty)) : emp.LAST_NAME.Contains(ssLastName.Text)) &&a

Using the "IN" Operator with SelectCommand Parameter


Good morning everyone,

Any ideas how I can use an "IN" operator with a SelectCommand Parameter.



Where @DEPTS is a value stored in a Cookie.  Cookie("DEPTS").Value is "232,243,250"

I keep getting an nvarchar to smallint conversion error.  Has anyone ever tried to do this?

return GUID

Hi,I am using LINQ.I have 2 methods.Method 1public Guid getUserIDByProfileCode(string pCode) { var user = from p in dc.OtherProfiles where p.ProfileCode == pCode select p.UserId; return user.FirstOrDefault(); }Method 2 public Guid getStudentUserId(int id) { var stdID = from p in dc.StudentProfiles where p.ID == id select p.UserId; return stdID.FirstOrDefault(); }The first method is ok. But the second method says "Can not implicitly convert System.GUID? to System.GUID. An explicit conversion exists (Are you missing a cast?)"What is the difference between these 2 mehtods?? how can I solve it?Error 2 Cannot implicitly convert type 'System.Guid?' to 'System.Guid'. An explicit conversion exists (are you missing a cast?) C:\WebDevelopment\DrivingSchool\DrivingSchool\BLL\RegistrationBLL.cs 150 20 DrivingSchool

Mod (%) operator on x86 vs x64

Hi all , I need help for resolve a strange bug – when I use mod (%) operator on x86 all good , But on x64 I get sometimes NaN as remainder ( it usually happens with Angle = 0). I managed to reproduce that bug outside my code , but only with Angle = double.Epsilon (at my code it also happens with Angle = 0). class Program { public const double M_PI = 3.14159265358979323846; static void Main(string[] args) { double m_2PI = (2 * M_PI); double m_Angle = double.Epsilon; double mod = (m_Angle % m_2PI); //x86 mod = 4.94065645841247E-324 //x64 mod = NaN if (double.IsNaN(mod)) Debug.Write(mod); } } Regards , Shay

How to use 'Like' operator in XQuery?

Hi All, I've a huge XML. Following is the layout: <Root>           <Request ID="12160884">                    <Command ID="1" Item="Start_Loading" Error="" />                    <Command ID="2" Item="GetData()" Error="Unknown group 'Data'" />                    <Command ID="3" Item="End_Loading" Error="" />           </Request>           <Request ID="12161224">                    <Command ID="1" Item="Start_Loading" Error="" />                    <Command ID="2" Item="GetCompanyInfo()" Error="" />               &

//Operator '+' cannot be applied to operands of type 'L' and 'L'

  public L Mymethod<L>(L mydate, L myname) {   //it is getting following errro   //Operator '+' cannot be applied to operands of type 'L' and 'L'   return (myname+myname); }   Can any one give me help how to solve following error

Using equal operator in transact-SQL for ntext datatype column

Hi, I've a problem with using equal operator in transact-SQL for ntext datatype column. (SQL Server 2000) I'm using the following SQL command text. use NorthwindSelect * from Categorieswhere Description ='Seaweed and fish' If I use 'like' operator intead of '=' then the qurey retuns correct value. Any idea about this? Any help is appreciated. Regards, Julia

The data types varchar and date are incompatible in the add operator

On the following query I keep getting the error 'The data types varchar and date are incompatible in the add operator'.  As you can see I have tried to convert the date but doesn't seem to work.  The variable @Date1 will start off as a date.  Any suggestions? ' declare @Date1 date declare @SQL1 varchar(2000) set @Date1 = convert(varchar, cast(getdate() as date), 102) set @SQL1 = 'select * from tbl_1 where convert(varchar,cast(tbl_1.Current_dt as date),102) = '+@Date1+'' print @SQL1    LISA86

ComboBox with Name and Guid

I have a simple question.  I am trying to store a Name and a Guid inside a combobox but it only lets me store one string value.  Is there any way to store the guid value along with the Name?  I need the guid because sometimes the name will be the same.  If not what would be the best way to approach this?   Thanks,

How to: Deal with UniqueIdentifiers, casting it to Guid in DAL

HelloMy users table has a column which is a unique identifier (basically this has FK relationship with aspnet_users table, of membership) Now I have an AppUser class which maps to my users tableuserid        intuser_aspnet_id  guid In my DAL, I am retreiving a user from the db an want to populate my appUser obj. How do i Convert value retreived to GuidappUsr.UserID = Convert.ToInt32(reader["user_id"]);appUsr.AspNetUserID =  reader["aspnet_user_id"];(There is no convert.ToGuid)How can this be done?appUsr.UserID = Convert.ToInt32(reader["user_id"]);                 appUsr.AspNetUserID = (Guid)reader["aspnet_user_id"];
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend