Count 0) Sql Data Adapter sda = new Sql Data Adapter(); Sql Command cmd Select = new Sql Command("SELECT PRD_NO, NAME FROM PRDT", _conn); sda.Update(ds, "PRDT"); } void sda_Row Updating(object sender, Sql Row Updating Event Args e) 结果你会发现我在Row Updating对行更新的植并没有更新到数据库中。显然生成的SQL语句的是在此之前就已经完成. Row Updating = new Sql Row Updating Event Handler(sda_Row Updating);放到Sql Command Builder my Command Builder = new Sql Command Builder(sda);之后时，SQL语句以及paramer里面参数就已经产生。所以必须把sda. Hi, I'm something of a noob at this, but here it is...I have an app that fills a dataset from a SQL database, and then writes the dataset to an xml file. I am basically just replicating data to the local user's machine, and several of the queries take a long time to run over VPN connection to the database (the way most of my users will use it), so I sank the whole operation into a Background Worker so that the user's app wont freeze up while it is running.
Normal you would update a datatable just as everything is done.
I am basically looking for an example here so that I can figure out how to apply it to my own circumstance. The dataadapter has no knowledge of how may rows it is going to 'import' until it has finished.
The first question you need to address is how much overhead is involved in retrieving the count first.
I would love to use the backgroundworker progresschanged event to control a progress bar and show the user how much longer the background operation is going to take, but I can't seem to figure out how to make that happen...
I have experimented with the dataadapter rowupdating event, but even if I can get that working (and so far I can't) it will only tell me how many rows it's already done, not how many it has to go...