**EDIT - I have determined that the reason it was taking so long was partly due to updating the Data Set every time a new row was added and outputting the counts of those records to a label. I moved the UPDATE outside of the loop and got an error. Sleep(1000) Dim int Index As Integer = 0 Dim str Name As String Dim dbl Lat Degrees As Double Dim dbl Lat Minutes As Double Dim dbl Lat Seconds As Double Dim str Lat Direction As String Dim dbl Lon Degrees As Double Dim dbl Lon Minutes As Double Dim dbl Lon Seconds As Double Dim str Lon Direction As String ' Loop through all records in the CO Data Table For Each CORow As Data Row In Towers Data Set. Open() Dim cust DS As Data Set = New Data Set cust DA. Fill(cust DS, "dwbprocref") For Each d Row In cust DS. In VB I am getting some information from one data Set and updating another. There is something close to 200k records in the Data Set and it is taking a very long time. Any suggestions on a faster method, please feel free to inform me. The Update method of the Data Adapter is called to resolve changes from a Data Set back to the data source.
Item("Stock Code") = "Re-Fashion[G]" End If Next It says to update data Adapter, isn't it? Private Sub btn Update_Click(By Val sender As System. Open() Dim cmd Select Command As Sql Command = New Sql Command("SELECT * FROM Stock", conx Main) cmd Select Command. Select Command = cmd Select Command Dim builder As Sql Command Builder = New Sql Command Builder(dad Purchase Info) dad Purchase Info. Dispose() End If If ds Purchase Info Is Not Nothing Then ds Purchase Info. I'm just guessing the query constructor is not able to generate an update statement for a table which doesn't have an identifier. (it looks like it doesn't - so it doesn't know what do to with update....) Here is an Update Command example:(for an employee table with 3 columns - as listed below: UPDATE [Employee] SET [name] = @name , [manager] = @manager WHERE (([id] = @Original_id) AND ((@Is Null_name = 1 AND [name] IS NULL) OR ([name] = @Original_name)) AND ((@Is Null_manager = 1 AND [manager] IS NULL) OR ([manager] = @Original_manager))); SELECT id , name , manager FROM Employee WHERE (id = @id) How about this part? Dim cmd Update Command As Sql Command = New Sql Command("UPDATE Stock SET Stock Code=' Re-Fashion(H)' WHERE Stock ID=2", conx Main) cmd Update Command. Update Command = cmd Update Command Dim cb Update As Sql Command Builder = New Sql Command Builder(dad Purchase Info) dad Purchase Info. Item("Stock Code") = "Re-Fashion(H)" End If Next dad Purchase Info. Click Dim conx Main As New Sql Connection("Data Source=SERVER; Initial Catalog=DBTest; Persist Security Info=True; User ID=username; Password=pwds") Dim dad Purchase Info As New Sql Data Adapter Dim ds Purchase Info As New Data Set1 Try Dim d Row As Data Row conx Main. Update(ds Purchase Info, "Stock") Catch ex As Exception Msg Box("Error : ") Finally If dad Purchase Info Is Not Nothing Then dad Purchase Info. [email protected] Devils: It's recommended you set that column as primary key, but that's beside the point. you can use visual studio wizard to generate an update command, or write it yoursefl. The Data Set instance is the Data Set that contains the changes that have been made, and the Data Table identifies the table from which to retrieve the changes.When you call the Update method, the Data Adapter analyzes the changes that have been made and executes the appropriate command (INSERT, UPDATE, or DELETE).