Microsoft Windows 2000/NT/2003: Cast Exception

  • ianmoores / 118 / Wed, 10 Feb 2010 08:06:00 GMT / Comments (0)
  • That's very odd the only thing i could think of is that somewhere on your
    live machine (assuming it is using a different database) you are returning a
    NULL value, which won't cast to an int, but might possibly not blow up using
    the Convert.ToInt32 that's a pure guess though


    >
    >I have a method in my DAL that accesses the DB to check the uniqueness of
    >an
    >item.
    >
    >From my sql (MySql db) I am returning a count (select count(*) )
    >
    >int recCount;
    >recCount = (int)cmd.ExecuteScalar();
    >
    >This works fine on my Dev machine. However, it is causing an invalid cast
    >exception on the Live machine and I have to change the line to the
    >following
    >to get the right result:
    >
    >recCount = Convert.ToInt32(myCmd.ExecuteScalar().ToString());
    >
    >Any ideas why this is happening?
    >
    >Thanks,
    >C
    >
    >
    >


    >This email and any files transmitted with it are confidential and
    >intended solely for the use of the individual or entity to whom they
    >are addressed. If you have received this email in error please notify
    >the system manager.
    >
    >This footnote also confirms that this email message has been swept by
    >MIMEsweeper for the presence of computer viruses.
    >
    >www.mimesweeper.com


    Yahoo! Groups Sponsor
    <font face=arial size=-1><a href="*">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font>

    Yahoo! Groups Links

    <*To visit your group on the web, go to:

    <*To unsubscribe from this group, send an email to:
    CSharpNET-unsubscribe (AT) yahoogroups (DOT) com

    <*Your use of Yahoo! Groups is subject to:
  • Keywords:

    cast, exception, microsoft, windows 2000, nt, 2003

  • http://www.edevs.com/windows-2000-nt/76643/«« Last Thread - Next Thread »»
  • Microsoft Windows 2000/NT/2003 Questions

    • groups and resources

      Setup ...I currently have 5 seperate domains seperated by T1 access and I am workingtowards having a...

      By kketsa

    • Creating Property Sets

      Hi Ray,As a general comment, quite a few "interesting" attributes (136 of them in AD2003) already be...

      By sakarikouti

    • THEY PAY YOU 12% DAILY FOR 12 DAYS. TOTAL 144%

      HelloI want to tell you. I already pay from 12dailypro many timesand I will shere a good opporttunit...

      By guaranteedget144%in12days___

    • cash drawer

      hi all,does anyone can tel me how to code for printing and opening the cashdrawer using Samsung SRP2...

      By elvand

    • Access Denied

      Im running Windows XPI moved my My Pictures folder to my D drive (because it has more space) and now...

      By warface, 3 Comments

    • Msconfig

      I would like to know why I can't uncheck programs from the Windows start program list when I go...

      By karbo, 11 Comments

    • FltMgr not starting after upgrade

      Thanks to the help of this newsgroup I ahve completed the upgrade of the 1stDC in my test environmen...

      By bettieclaxton, 3 Comments

    • Sign in with Windows live ID

      Hello,I am having trouble when going to the c:\documents and settings\User folder it keeps coming up...

      By bizzt, 1 Comments

    • sidewinder wheel with pedals force feedback 2000 d...

      hello can anyone tell me where I can get drivers for mysidewinder force feedback wheel with pedals? ...

      By drblood, 2 Comments