Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Operator '=' is not defined for types 'System.Object' and 'System.Guid'.

Posted on 2006-10-26
7
Medium Priority
?
349 Views
Last Modified: 2008-01-09
Can anyone advise how I should be doing this in vb.Net 2003?

The line of code I'm trying to run is:

   SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid).Value = myGuid)

myGuis is of type System.GUID whereas the parameter wants an object? I thought this would be ok?

Please help!!
0
Comment
Question by:David_Reid_1985
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:hclgroup
ID: 17813080
You need to convert myGuid to String

e.g.  SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid).Value = myGuid.ToString())
0
 

Author Comment

by:David_Reid_1985
ID: 17813188
Apologies, I should have mentioned, already tried that... I now receive:

"Specified cast is not valid."

:(

Any ideas?
0
 
LVL 4

Expert Comment

by:hclgroup
ID: 17813252
You could try

SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid, myGuid.ToString())
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:hclgroup
ID: 17813254
Forget a bracket

SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid, myGuid.ToString()))
0
 
LVL 6

Expert Comment

by:davbouchard
ID: 17813283
I'm close to telling you just to do it on two lines :-), but:
What if you try
SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid).Value = ctype(myGuid,object))

0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 17813367
The location of your brackets is causing the problem:

    SQLCommand.Parameters.Add(New VistaDB.VistaDBParameter("@ID", VistaDB.VistaDBType.Guid)).Value = myGuid
0
 

Author Comment

by:David_Reid_1985
ID: 17814314
Gawwd its been one of those days!!! Thanks very much :D:D:D:D
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question