martinrybak / SQLClient

Native Microsoft SQL Server client for iOS
http://objcsharp.wordpress.com/2013/10/15/an-open-source-sql-server-library-for-ios/
MIT License
124 stars 51 forks source link

GUID not generated correctly #61

Closed danmartyn closed 6 years ago

danmartyn commented 6 years ago

Hello,

I'm trying to connect to a server and get some info from a table, where one of the columns is a GUID. When I look at the values in the dictionary, the GUID is not matching with what is in the table when I look at it from running a SQL query in Visual Studio Code. The last 2 portions are correct, but the first 3 portions have the correct values, but are not in the correct order. Any idea what is going on there? This is running on macOS 10.13.4 on a MacBook Pro.

Thanks

martinrybak commented 6 years ago

That is due to the Microsoft string representation of a GUID being different than the actual byte order: https://msdn.microsoft.com/en-us/library/system.guid.tobytearray.aspx?f=255&MSPPError=-2147217396

danmartyn commented 6 years ago

Does that mean there's no way to get the same representation as what's stored in the DB?