tags:

views:

59

answers:

1

I have a .NET application which allows users to access various databases by providing a connection string and a provider.

One of the databases which users want to access is a MySQL database (not mine so I can't change it) where the primary keys are all stored as GUIDs.

My application can access records in various tables in that database when using the MySQL ODBC 3.51 Driver.

But using exactly the same code (taking into account that ODBC needs a ? in place of a parameter name whereas the .NET connector needs the "@name" syntax), and attempting to read the same records in the same tables but this time with the MySQL .NET Connector (V6.1.3 as well as v6.2.2), then I get the error "Guid should contain 32 digits with 4 dashes ...".

Is there something wrong with the .NET Connector, or is there something I need to specify somewhere to make it work?

+1  A: 

Well, after scouting around a bit, I thought I would see if MySQL had released a later version of the .NET Connector than I had. I found http://dev.mysql.com/doc/refman/5.1/en/connector-net-news-6-1-3.html. That says something about the error that I was receiving, and speaks about an option "old guids=true" in the connection string (it doesn't say when and how you should use this, but that it didn't work properly in version 6.1.3).

I tried putting "oldguids=true" in my connection string, and then my generic application worked.

Peter