SByte vs. bool vs. TinyInt

M

Martin Groh

I have a weird bug reading a tinyint for a MySQL database.

I have this line in my code

jig.init = row.Field<bool>("initilizing");

Witch was working fine until a little while ago. But now I'm getting an runtime error saying can't use SByte as ......

Still the same program runs fine on another machine.



I then change the line to

jig.init = row.Field<SByte>("initilizing") == 1;

Now it works on my machine, but not the other one.

Both machines use .net 3.5

Any ideas?





regards Martin
 
N

Nicholas Paldino [.NET/C# MVP]

Martin,

I'd put some trace code into the system and figure out what the type of the "initilizing" (sp) field is (call GetType and put it in the trace).

Are they both accessing the same instance of the database, or do they have separate instances? If they are separate, then I would imagine the schema on one has been changed.

Either that, or it could be driver/provider issues on the machine.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
I have a weird bug reading a tinyint for a MySQL database.

I have this line in my code

jig.init = row.Field<bool>("initilizing");

Witch was working fine until a little while ago. But now I'm getting an runtime error saying can't use SByte as ......

Still the same program runs fine on another machine.



I then change the line to

jig.init = row.Field<SByte>("initilizing") == 1;

Now it works on my machine, but not the other one.

Both machines use .net 3.5

Any ideas?





regards Martin
 
M

Martin Groh

I took a stack trace on both machines. And on my machine it was a SByte, and on the other it was a bool.

The machines are using a local DB, but then I made a new copy to test this, so they are identical.
When it comes to drives, I had to upgrade them when I installed the other machine (last week).
So they are running MySql.Data.dll v 5.2.5.0

But I only notice this bug after I upgraded it on my machine!

I manage to work my way around this by using

jig.init = Convert.ToBoolean(row.Field<object>("initilizing"));

works fine for both Sbyte and bool.

But I still would like to know why this differs from machine to machine?



..:martin

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> skrev i melding Martin,

I'd put some trace code into the system and figure out what the type of the "initilizing" (sp) field is (call GetType and put it in the trace).

Are they both accessing the same instance of the database, or do they have separate instances? If they are separate, then I would imagine the schema on one has been changed.

Either that, or it could be driver/provider issues on the machine.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
I have a weird bug reading a tinyint for a MySQL database.

I have this line in my code

jig.init = row.Field<bool>("initilizing");

Witch was working fine until a little while ago. But now I'm getting an runtime error saying can't use SByte as ......

Still the same program runs fine on another machine.



I then change the line to

jig.init = row.Field<SByte>("initilizing") == 1;

Now it works on my machine, but not the other one.

Both machines use .net 3.5

Any ideas?





regards Martin
 
P

Peter Morris

Is it a Win32 Vs Win64 setup? How do the machines differ operating system
wise?
 
M

Martin Groh

My developer machine is a 32bit Vista business (not sp1) running Visual
Studio 2008 and .net 3.5 (not sp1 here either).
The test machine runs XP pro sp3 and .net 3.5

The local setting on vista is Norwegian and on the test machine it's
English.
Still the developer machine used to treated the TinyInt the same way as the
test machine do now, until (probably) I upgraded the MySql drivers so they
would match on the to machines.

..:martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top