Update problem when using Uniqueidentifiers with a typed dataset

I have a VB.NET application that worked fine when I was storing my SQL-Server Uniqueidentifiers as Strings. But when I converted my database to store these Uniqueidentifiers as actual SQL-Server Uniqueidentifiers, I was no longer able to update my SQL-Server database from my dataset (though data still loads fine FROM the database INTO the dataset). The error I get is: "Invalid cast from System.String to System.Guid."

After some web research, I decided to change the Guid-related elements in my XSD file in such a way as to define those Guid-related elements as having a DataType of Guid (though leaving the Type as string). In other words, an XSD element like this:

<xs:element name="appointment_guid" type="xs:string" />
became an XSD element like this:
<xs:element name="appointment_guid" msdata:DataType="System.Guid, mscorlib,
version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string" />

Yet STILL I get the same error "Invalid cast from System.String to System.Guid" whenever I try to save the dataset and update the database. Moreover, when I inspect the offending row in the dataset, it shows HasErrors=True and Rowerror = "Invalid cast ..." etc. Yet the value of every Guid in that row seems to be either a proper Guid or a proper System.DBNull.Value.

Any suggestions as to what the problem might be?

Any help given would be greatly appreciated!

[1453 byte] By [PhilEngle] at [2007-12-16]
# 1
Try using the supported SQL type in the .Net framework, System.Data.SqlTypes.SqlGuid
TimWilliams at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...

.NET Development

Site Classified