There are a few things not quite right:
Use UniqueIdentifier for GUID. There is a reason why SQL got this data type. http://en.wikipedia.org/wiki/Globally_unique_identifier
If
Hosted_GUID
is declared as GUID, then you obviously can't implicitly convert like that!Hosted_GUID = comm.ExecuteScalar()
=> If you define your GUID-Column as UniqueIdentifier, your problems will suddenly disappear. Though make sure to check if comm.ExecuteScalar is Nothing.
MSDN about ExecuteScalar
:
The first column of the first row in the result set, or a null reference.
EDIT: If you can not alter your current Column to UniqueIdentifier, last option would be to convert the string in code to GUID:
Hosted_GUID = new Guid(comm.ExecuteScalar())
Sidenote: Also make sure to use parameterized queries.