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. Advertising

  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. Advertising

  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. Advertising

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.

Share This Page