[Mono-list] Npgsql myCommand.ExecuteScalar type cast issue

Francisco Figueiredo Jr. fxjrlists at yahoo.com.br
Sun Dec 25 12:00:26 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe Audette wrote:
> Being close to christmas not everyone may be reading the mail but Francisco is the developer of npgsql and I know he follows this list.
>  

Hi Joe. That was exactly what happened :)


Christopher, do you have a test case for your problem?


To check what type is being returned, add the following:

Console.WriteLine(command.ExecuteScalar().GetType());

What type in your database is the field which you are doing the
executeScalar()?

If you are using an select * from some table, Postgresql changed the
type of the data returned from int4 to int8, which Npgsql translates to
Int64. So, you may be receiving an Int64 and this explains why you may
be not being able to directly cast it to int32.

I hope it helps.



- --
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
Npgsql Lead Developer
http://www.pgfoundry.org/projects/npgsql
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org


- -------------
"Science without religion is lame;
religion without science is blind."

                  ~ Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBQ67QKf7iFmsNzeXfAQJgZwf9H43hq/tDk0F2H/BW44kCAF19ebvwOMMs
1fZICFP4yavhd1Lc5U2yrDEGuB5twZCrg+HLfQAeWFO21rCax9JSdgv4h2SM2KFx
kSLzKcWFHeowyiSfgq5AQhoMf4jbyBOhA122cEI90ZcY8TM7NjxLviyjU9RihrTv
AT/GOW3ShFrxnD8vJYSWyxvP4OxPcNPsLcHe2Ba9NcvpfCZRD21NJa1OuN1jcsg0
3AD4AW8bJig8Uh+YJHJGuD5A/aWTBvEVniWcsZ0OVtwqkSo/fyc45RNllqNb7vR/
VxpxiAUOHwxWUpGrttjoYd1phOH4ZzIycGIBrsgFoApU0/19d+07Gw==
=T2nN
-----END PGP SIGNATURE-----

	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 



More information about the Mono-list mailing list