Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Index was out of range. Must be non-negative and less than the size of the collection.

Index was out of range. Must be non-negative and less than the size of the collection.

Scheduled Pinned Locked Moved ASP.NET
helpcssdatabase
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haleemasher
    wrote on last edited by
    #1

    i face an error Index was out of range. Must be non-negative and less than the size of the collection in this code plz help

    cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

    J P M C 4 Replies Last reply
    0
    • H haleemasher

      i face an error Index was out of range. Must be non-negative and less than the size of the collection in this code plz help

      cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      Please don't cross post.

      1 Reply Last reply
      0
      • H haleemasher

        i face an error Index was out of range. Must be non-negative and less than the size of the collection in this code plz help

        cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #3

        haleemasher wrote:

        cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

        use: cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex][0] + "'";

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        1 Reply Last reply
        0
        • H haleemasher

          i face an error Index was out of range. Must be non-negative and less than the size of the collection in this code plz help

          cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

          M Offline
          M Offline
          mrcooll
          wrote on last edited by
          #4

          Please don't cross post.

          if(e.RowIndex==-1)
          return;

          1 Reply Last reply
          0
          • H haleemasher

            i face an error Index was out of range. Must be non-negative and less than the size of the collection in this code plz help

            cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Damn - how stupid are people today ? What do you THINK that error message could mean ? Do you know how to use a debugger ?

            Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups