Saturday 15 March 2014

vb.net - I need a Faster way to update a DataSet in VB -



vb.net - I need a Faster way to update a DataSet in VB -

in vb getting info 1 dataset , updating another. there close 200k records in dataset , taking long time. close 2 minutes per one thousand records.

any suggestions on faster method, please sense free inform me.

**edit - have determined reason taking long partly due updating dataset every time new row added , outputting counts of records label. moved update outside of loop , got error. removed reportprogress , label output , error goes away. guess looking suggestions on how send info progress bar or label without failing. think outputting label takes longer actual row creation.

private sub bgwupdate_dowork(sender object, e system.componentmodel.doworkeventargs) handles bgwupdate.dowork system.threading.thread.sleep(1000) dim intindex integer = 0 dim strname string dim dbllatdegrees double dim dbllatminutes double dim dbllatseconds double dim strlatdirection string dim dbllondegrees double dim dbllonminutes double dim dbllonseconds double dim strlondirection string ' loop through records in co datatable each corow datarow in towersdataset.co strname = cstr(towersdataset.co.company_namecolumn.table.rows(intindex).item("company_name")) dbllatdegrees = cdbl(towersdataset.co.latitude_degreescolumn.table.rows(intindex).item("latitude_degrees")) dbllatminutes = cdbl(towersdataset.co.latitude_minutescolumn.table.rows(intindex).item("latitude_minutes")) dbllatseconds = cdbl(towersdataset.co.latitude_secondscolumn.table.rows(intindex).item("latitude_seconds")) strlatdirection = cstr(towersdataset.co.latitude_directioncolumn.table.rows(intindex).item("latitude_direction")) dbllondegrees = cdbl(towersdataset.co.longitude_degreescolumn.table.rows(intindex).item("longitude_degrees")) dbllonminutes = cdbl(towersdataset.co.longitude_minutescolumn.table.rows(intindex).item("longitude_minutes")) dbllonseconds = cdbl(towersdataset.co.longitude_secondscolumn.table.rows(intindex).item("longitude_seconds")) strlondirection = cstr(towersdataset.co.longitude_directioncolumn.table.rows(intindex).item("longitude_direction")) ' create new row info gathered dim updaterow gps_fundataset1.locationsrow updaterow = gps_fundataset1.locations.newlocationsrow updaterow.name = strname updaterow.type = "tower" updaterow.latitude = convert.todecimal(cstr(dbllatdegrees) + " " + cstr(dbllatminutes) + " " + cstr(dbllatseconds) + strlatdirection) updaterow.longitude = convert.todecimal(cstr(dbllondegrees) + " " + cstr(dbllonminutes) + " " + cstr(dbllonseconds) + strlondirection) ' add together row datatable gps_fundataset1.locations.rows.add(updaterow) ' update actual database seek locationsbindingsource.endedit() locationstableadapter.update(gps_fundataset1.locations) grab ex exception console.writeline("failure") end seek bgwupdate.reportprogress(intindex + 1) intindex += 1 next end sub

vb.net visual-studio dataset

No comments:

Post a Comment