Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Guids
Message
From
19/06/2008 17:04:40
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Re: Guids
Environment versions
Environment:
C# 3.0
OS:
Vista
Database:
MS SQL Server
Miscellaneous
Thread ID:
01325529
Message ID:
01325556
Views:
12
In VFP guids are just 36 char fields. They can be empty. But when you pass them to SQL they have to be cast as Binary16 in order to be a UID so first they all must be in the right format or null.

Also, remember those characters in the guid represent Hexidecimal pairs, so if you have some that were 'hand written' (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) they won't cast. A way to do a quick search in the char(36) fields to find bad guids is to look for those that don't have 4 in the 15th position.



>I have fox tables that have ID columns of type double that I converted to C(36) and repopulated with a guid value and cascaded those values down to child tables. I do a query via OleDbAdapter to load said tables into memory in my C# app.
>
>I created a copy of said table in Sql Server and the ID column is of type uniquidentifer. When I try and move the table to the server from the dataset via a Bulk Copy - WriteToServer() call I get an error "The given value from the data source cannot be converted to type uniqueidentifier of the specified column".
>
>So I went back and made my fox columns type varbinary and casted the guid values to a type Q. Repeated the same process and got same error.
>
>What do I need to do to get the data type conversion to work? Fox has no problem with the guid and I can see them in the column with the dataset XML visualizer.
>
>Thanks all,
>
>MW


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform