how can i save a null value from web control to an integer field in the data base

Discussion in 'ASP .Net' started by casper_992@hotmail.com, Sep 26, 2005.

  1. Guest

    i've a data base that has an integer field ,and i wanna save null value
    to that field, but it gives me an error "Input string was not in a
    correct format. " when i click a button to save.
     
    , Sep 26, 2005
    #1
    1. Advertisements

  2. Rob Schieber Guest

    Re: how can i save a null value from web control to an integer fieldin the data base

    wrote:
    > i've a data base that has an integer field ,and i wanna save null value
    > to that field, but it gives me an error "Input string was not in a
    > correct format. " when i click a button to save.
    >


    try passing null instead of an empty string.

    if(string == string.Empty())
    parm.value = null;


    --
    Rob Schieber
     
    Rob Schieber, Sep 26, 2005
    #2
    1. Advertisements

  3. RE: how can i save a null value from web control to an integer field i

    Did you try "System.DBNull.Value"?

    Ryan

    "" wrote:

    > i've a data base that has an integer field ,and i wanna save null value
    > to that field, but it gives me an error "Input string was not in a
    > correct format. " when i click a button to save.
    >
    >
     
    =?Utf-8?B?Q2FsbCBKYXZhc2NyaXAgZnJvbSB0aGUgc2VydmVy, Sep 26, 2005
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. crjunk
    Replies:
    2
    Views:
    6,985
    crjunk
    Feb 2, 2004
  2. Reny J Joseph Thuthikattu
    Replies:
    1
    Views:
    807
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 30, 2004
  3. Replies:
    5
    Views:
    30,007
    Mike Schilling
    Mar 29, 2006
  4. Hans Östlund
    Replies:
    1
    Views:
    281
    Alessandro Zifiglio
    Feb 5, 2004
  5. Replies:
    6
    Views:
    478
  6. Sound
    Replies:
    2
    Views:
    719
    Randy Webb
    Sep 28, 2006
  7. VUNETdotUS
    Replies:
    25
    Views:
    864
    Thomas 'PointedEars' Lahn
    Nov 10, 2007
  8. jr
    Replies:
    3
    Views:
    665
Loading...