The
ProgrammingMSAccess.COM Site
This sub procedure
prints the shippers table from two different datasets. The procedure will
likely be called from a click event procedure. you can adapt the code to
compare the data in any two datatables in two different datasets.
Sub PrintDataSets()
Dim das1 As DataSet
Dim dtb1 As DataTable
Dim drw1 As DataRow
Dim int1 As Integer
das1 = Me.DataSet1User11
dtb1 = das1.Tables("Shippers")
Console.WriteLine("Output from DataSet1User11")
For int1 = 0 To dtb1.Rows.Count - 1
Console.WriteLine("{0}, {1}, {2}", _
DataSet1User11.Tables("Shippers").Rows(int1)(0), _
DataSet1User11.Tables("Shippers").Rows(int1)(1), _
DataSet1User11.Tables("Shippers").Rows(int1)(2))
Next int1
Console.WriteLine(ControlChars.CrLf)
das1 = Me.DataSet1User21
dtb1 = das1.Tables("Shippers")
Console.WriteLine("Output from DataSet1User21")
For int1 = 0 To dtb1.Rows.Count - 1
Console.WriteLine("{0}, {1}, {2}", _
DataSet1User21.Tables("Shippers").Rows(int1)(0), _
DataSet1User21.Tables("Shippers").Rows(int1)(1), _
DataSet1User21.Tables("Shippers").Rows(int1)(2))
Next int1
Console.WriteLine(ControlChars.CrLf)
End Sub
Learn more about VB.NET programming from either
Programming Microsoft SQL Server 2000 with
Microsoft Visual Basic .NET or
Programming Microsoft Visual Basic .NET for Microsoft Access Databases.
Copyright 2003 CAB, Inc. All rights reserved. Republication or redistribution
of CAB, Inc. content, including by framing or similar means, is expressly
prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be
liable for any errors in the content, or for any actions taken in reliance
thereon.