Link to home
Start Free TrialLog in
Avatar of bail3yz
bail3yz

asked on

How to get bigint from database in C#?

This code in C# doesnt work.. it crashes ... playerid does have a value in the database.. and it is a bigint


long playerid;
playerid = (long)pRS.Fields["playerid"].Value;


This code in C++ does work.
long playerid;
playerid=pRS->Fields->GetItem("playerid")->GetValue();


Can anyone tell me why the C# code isnt working?
I am able to get all the other info in C# (strings).


The error I get is

"Specified cast is not valid"
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bail3yz
bail3yz

ASKER

Perfect! Works great...

Thank you !