ExecuteNonQuery

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • .

    #1

    ExecuteNonQuery

    Hi,

    I'm studying for a Microsoft exam.

    Can you tell me what will be returned if say I try to update a table in a
    database using something like:
    myCommand.Execu teNonQuery();

    and no rows are actually updated? Will it return zero?

    Thanks.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: ExecuteNonQuery

    ..,

    It should return zero.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "." <dot@dotworld.c om> wrote in message
    news:%231e9KIwo DHA.2588@tk2msf tngp13.phx.gbl. ..[color=blue]
    > Hi,
    >
    > I'm studying for a Microsoft exam.
    >
    > Can you tell me what will be returned if say I try to update a table in a
    > database using something like:
    > myCommand.Execu teNonQuery();
    >
    > and no rows are actually updated? Will it return zero?
    >
    > Thanks.
    >
    >[/color]


    Comment

    • Alan Pretre

      #3
      Re: ExecuteNonQuery

      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
      message news:OV2SCVwoDH A.3688@TK2MSFTN GP11.phx.gbl...[color=blue]
      > It should return zero.[/color]
      [color=blue][color=green]
      > >
      > > Can you tell me what will be returned if say I try to update a table in[/color][/color]
      a[color=blue][color=green]
      > > database using something like:
      > > myCommand.Execu teNonQuery();
      > >
      > > and no rows are actually updated? Will it return zero?[/color][/color]

      However, CREATE TABLE and DROP TABLE return -1, not 0.

      -- Alan



      Comment

      • .

        #4
        Re: ExecuteNonQuery

        Thanks all.


        "Alan Pretre" <no@spam> wrote in message
        news:OKcSEcwoDH A.744@tk2msftng p13.phx.gbl...[color=blue]
        > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote[/color]
        in[color=blue]
        > message news:OV2SCVwoDH A.3688@TK2MSFTN GP11.phx.gbl...[color=green]
        > > It should return zero.[/color]
        >[color=green][color=darkred]
        > > >
        > > > Can you tell me what will be returned if say I try to update a table[/color][/color][/color]
        in[color=blue]
        > a[color=green][color=darkred]
        > > > database using something like:
        > > > myCommand.Execu teNonQuery();
        > > >
        > > > and no rows are actually updated? Will it return zero?[/color][/color]
        >
        > However, CREATE TABLE and DROP TABLE return -1, not 0.
        >
        > -- Alan
        >
        >
        >[/color]


        Comment

        Working...