Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3609060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:34:44+00:00 2026-05-18T21:34:44+00:00

we need to compare the content of 2 identical gridviews and extract rows that

  • 0

we need to compare the content of 2 identical gridviews and extract rows that differ in a third gridview, is this doable?

i tried a lot but faced no luck, please help me.

at our office we take daily backup of ASP.net application ms access backend

for the next few days we need to evaluate the changes made to records in the database tables

at the end of each day i want to compare 2 access databases first database is the backup of yesterday and second database is the backup of today

i thought of the following algorithm, please read carefully and tell me how to proceed to compare the datatables / gridviews

i need to display th rows / cells containing the differences / updates / deleted data

comparing two ms access backend databases of an asp.net web application

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:34:45+00:00Added an answer on May 18, 2026 at 9:34 pm

    my team and myseld figured it out

    Imports System.Data
    Imports System.Data.OleDb
    Partial Class MoKoTrack
    Inherits System.Web.UI.Page
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myDB = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|databaseName.mdb;Persist Security Info=True")
    
        Session("CurrentDB") = myDB
    
    
        myDB.open()
        Dim mytables = myDB.GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys, New Object() {})
    
        Dim CurrentTable As String
    
        For i = 1 To mytables.Rows.Count
            CurrentTable = mytables.Rows(i - 1).Item(2).ToString
            If CurrentTable.Contains("Backup") Then CompareTable(CurrentTable, mytables.Rows(i - 1).Item(3).ToString)
        Next i
    
        '        Dim myGrid As New GridView
        'myGrid.DataSource = mytables
        'myGrid.DataBind()
        'Me.Form.Controls.Add(myGrid)
        'myDB.Close()
    End Sub
    
    Sub CompareTable(ByVal BackupTableName As String, ByVal myPrimKey As String)
    
        Dim OriginalTable As New DataTable
        Dim BackupTable As New DataTable
        Dim ModificationsTable As New DataTable
        Dim AddedTable As New DataTable
        Dim DeletedTable As New DataTable
    
        Dim myDB = Session("CurrentDB")
        Dim FinalSQLString = "SELECT * FROM [" + BackupTableName + "]"
        Dim myDBCommand = New OleDbCommand(FinalSQLString, myDB)
        Dim myReader As IDataReader = myDBCommand.ExecuteReader()
    
        BackupTable.Load(myReader)
    
        Dim OriginalTableName = Left(BackupTableName, Len(BackupTableName) - 6)
        Dim FinalSQLString2 = "SELECT * FROM [" + OriginalTableName + "]"
        Dim myDBCommand2 = New OleDbCommand(FinalSQLString2, myDB)
        'Generate a temporary reader to get the number of cases
        Dim myReader2 As IDataReader = myDBCommand2.ExecuteReader()
        OriginalTable.Load(myReader2)
    
        Dim myPrimColumn(0) As DataColumn
        myPrimColumn(0) = OriginalTable.Columns(myPrimKey)
        OriginalTable.PrimaryKey = myPrimColumn
        Dim myPrimColumn2(0) As DataColumn
        myPrimColumn2(0) = BackupTable.Columns(myPrimKey)
        BackupTable.PrimaryKey = myPrimColumn2
    
    
        AddedTable = OriginalTable.Clone
        DeletedTable = OriginalTable.Clone
        ModificationsTable = OriginalTable.Clone
        ModificationsTable.PrimaryKey = Nothing
    
        Dim CurrentVal As String
    
        For i = 0 To OriginalTable.Rows.Count - 1
            CurrentVal = OriginalTable.Rows(i).Item(myPrimKey).ToString
            Dim foundRow As DataRow = BackupTable.Rows.Find(CurrentVal)
            If foundRow IsNot Nothing Then
                For t = 0 To OriginalTable.Columns.Count - 1
                    If Not foundRow.Item(t).ToString = OriginalTable.Rows(i).Item(t).ToString Then
                        ModificationsTable.ImportRow(OriginalTable.Rows(i))
                        'ModificationsTable.Rows(ModificationsTable.Rows.Count - 1).Item(t) = ModificationsTable.Rows(ModificationsTable.Rows.Count - 1).Item(t) & "Modified"
                        ModificationsTable.ImportRow(foundRow)
                    End If
                Next
    
    
            Else
                AddedTable.ImportRow(OriginalTable.Rows(i))
            End If
    
        Next
    
        For i = 0 To BackupTable.Rows.Count - 1
            CurrentVal = BackupTable.Rows(i).Item(myPrimKey).ToString
            Dim foundRow As DataRow = OriginalTable.Rows.Find(CurrentVal)
            If foundRow Is Nothing Then
                DeletedTable.ImportRow(OriginalTable.Rows(i))
            End If
    
        Next
    
        If AddedTable.Rows.Count > 0 Then
            Dim myLabel As New Label
            myLabel.Text = "<br/> The following records were added to table " & OriginalTableName & "<br/> <br/>"
            Me.form1.Controls.Add(myLabel)
            Dim myGrid As New GridView
            myGrid.DataSource = AddedTable
            myGrid.DataBind()
            Me.form1.Controls.Add(myGrid)
        End If
    
        If ModificationsTable.Rows.Count > 0 Then
            Dim myLabel As New Label
            myLabel.Text = "<br/> The following records were modified in table " & OriginalTableName & "<br/> <br/>"
            Me.form1.Controls.Add(myLabel)
            Dim myGrid As New GridView
            myGrid.DataSource = ModificationsTable
            myGrid.DataBind()
            Me.form1.Controls.Add(myGrid)
        End If
    
        If DeletedTable.Rows.Count > 0 Then
            Dim myLabel As New Label
            myLabel.Text = "<br/> The following records were deleted from table " & OriginalTableName & "<br/> <br/>"
            Me.form1.Controls.Add(myLabel)
            Dim myGrid As New GridView
            myGrid.DataSource = DeletedTable
            myGrid.DataBind()
            Me.form1.Controls.Add(myGrid)
        End If
    
    
    End Sub
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need an application that will compare the content of 2 folders byte by
I need to compare particular content of 2 SQL tables located in different servers:
I need to compare two dictionary values if the types stored are equal, this
This question comes from a need to ensure that changes I've made to code
I need to compare the content of two tables, more exactly two columns (one
Im using MVC3 architecture, c#.net. I need to compare text box content(User ID) with
this code is used to compare the content of 2 text files, but i
I need to compare large count of PDF files for it optical content. Because
I need to compare two Unix timestamps and I'm having trouble with the math.
I need to compare the last string of a url with the id of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.