Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 477
  • Last Modified:

Option Strict On disallows implicit conversions from 'Object' to 'System.Guid'

I'm getting the following error:

Option Strict On disallows implicit conversions from 'Object' to 'System.Guid'


Here's my code:


Dim prmOutputParam As SqlParameter = cm.Parameters.Add("@UserKeyGUID", SqlDbType.UniqueIdentifier)
prmOutputParam.Direction = ParameterDirection.Output


Dim tmpGUID As Guid
tmpGUID = cm.Parameters("@UserKeyGUID").Value


What is the proper way to tell .NET that cm.Parameters("@UserKeyGUID").Value is a Guid and not an Object?

0
CarlaGibson
Asked:
CarlaGibson
  • 2
  • 2
1 Solution
 
Fernando SotoRetiredCommented:
This should work.

tmpGUID = CType(cm.Parameters("@UserKeyGUID").Value, Guid)
0
 
CarlaGibsonAuthor Commented:
Perfect!  I knew it was something easy!!  Thanks!
0
 
CarlaGibsonAuthor Commented:
Thanks!
0
 
Fernando SotoRetiredCommented:
Not a problem, glad I was able to help.  ;=)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now