Okay, Karl, I've sucumbed to the emotional blackmailHere's the #'$%*@!!! code (needed to put the update after each record / in the loop
:
As above, my SQL server crashed so you'll need to modify the connection string - and you missed an End Try at the end, though I guess this is just part of the code you posted.Code:Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;" & _ "Mode=ReadWrite;Persist Security Info=False;" Dim myConn As New ADO.ADOConnection(ConnStr) Dim myCommand As New ado.ADOCommand("SELECT * FROM Customers", myConn) Dim myDataSetCommand As New ado.ADODataSetCommand(myCommand) Dim myDataSet As New DataSet("Test1") Try myConn.Open() myDataSetCommand.FillDataSet(myDataSet, "Customers") Dim myRow As System.Data.DataRow For Each myRow In myDataSet.Tables("Customers").Rows Console.WriteLine("Company Name: " & CStr(myRow("CompanyName"))) myRow("CompanyName") = CStr(myRow("CompanyName")) & " :c)" myDataSetCommand.Update((myDataSet), ("Customers")) Next myrow Msgbox("Done !") Catch myException As Exception MsgBox(myException.ToString) Finally If myConn.State = DBObjectState.Open Then myConn.Close() End If If Not myDataSet Is Nothing Then myDataSet = Nothing End If End Try End Sub
Good luck & I look forward to reading the tutorial if it's anything like your others.
Just 1 point more - why did you name this thread as "ADO.NET Code - SIMPLE ?!?!?!?!![]()




Here's the #'$%*@!!! code (needed to put the update after each record / in the loop
:
Reply With Quote