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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Data ADO.net Question

Data ADO.net Question

Scheduled Pinned Locked Moved Visual Basic
questioncsharptutorial
4 Posts 2 Posters 5 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.
  • M Offline
    M Offline
    maxiachun
    wrote on last edited by
    #1

    When i use Dataadapter to fill datatable, if the data amount is huge, the user has to wait for a long time, so maybe they want to cancel that operation, how to do that ? SqldataAdapter.fill(mydataset.mydatatable) how to stop this operation I am Entry level person

    D 1 Reply Last reply
    0
    • M maxiachun

      When i use Dataadapter to fill datatable, if the data amount is huge, the user has to wait for a long time, so maybe they want to cancel that operation, how to do that ? SqldataAdapter.fill(mydataset.mydatatable) how to stop this operation I am Entry level person

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You can't. Since this code is most probably executing on the UI thread, you'll notice it's a blocking call and won't return execution to the next line until this query finishes. If you can't execute any code on that thread, there's no way you can click on a button, let alone make this call stop. The only way to "stop" this call is to run the query on a background thread, freeing the UI thread to do other things. To cancel this query, all you have to do is ignore the return from the query thread. Threading is by no means an entry-level thing to put together. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        You can't. Since this code is most probably executing on the UI thread, you'll notice it's a blocking call and won't return execution to the next line until this query finishes. If you can't execute any code on that thread, there's no way you can click on a button, let alone make this call stop. The only way to "stop" this call is to run the query on a background thread, freeing the UI thread to do other things. To cancel this query, all you have to do is ignore the return from the query thread. Threading is by no means an entry-level thing to put together. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        M Offline
        M Offline
        maxiachun
        wrote on last edited by
        #3

        i used mydataAdapter.selectcommand.cancel to cancel that operation. it returns a error which is cancelbyuser sqlexeption I am Entry level person

        D 1 Reply Last reply
        0
        • M maxiachun

          i used mydataAdapter.selectcommand.cancel to cancel that operation. it returns a error which is cancelbyuser sqlexeption I am Entry level person

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          SqlCommand.Cancel[^] docs with an example. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          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