this is my code.. i got both my work database and my master database on the datagrid views in my form...but how do i go about
comparing..

and generating the crystal report ?

imports System.Data.oledb

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

End

End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Map Database.mdb")

Dim cmd As New OleDbCommand

con.Open()

cmd = New OleDbCommand("select * from table1", con)

Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)

Try

Dim ds As DataSet = New DataSet()

ds.Tables.Add("table1")

da.Fill(ds, "table1")

DataGridView1.DataSource = ds.Tables("table1").DefaultView

Finally

con.Close()

cmd = Nothing

da.Dispose()

con.Dispose()

End Try

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Final Database.mdb")

Dim cmd As New OleDbCommand

con.Open()

cmd = New OleDbCommand("select * from table1", con)

Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)

Try

Dim ds As DataSet = New DataSet()

ds.Tables.Add("table1")

da.Fill(ds, "table1")

DataGridView2.DataSource = ds.Tables("table1").DefaultView

Finally

con.Close()

cmd = Nothing

da.Dispose()

con.Dispose()

End Try

End Sub

End Class

i am working on the button which would match all the values .. I get stuck at the comparison statment while matching values..can u please help me figure out how the comparison has to be done ?

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Map Database.mdb")

Dim con1 As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Final Database.mdb")


Dim objcmd As New Data.OleDb.OleDbCommand

Dim objcmd1 As New Data.OleDb.OleDbCommand

Dim objrdr As Data.OleDb.OleDbDataReader

Dim objrdr1 As Data.OleDb.OleDbDataReader

If objrdr.HasRows Then

Do While objrdr.Read

If ((objrdr.GetValue(0) = (objrdr1.GetValue(0)))Then

End If

Loop

end if

End Sub

End Class

i tried the following but I am still getting errors.. I am trying to see if the first element under the first field in my work DB exists on any row of the same field in my Master DB.. i am trying to correct the code..can u please assist me ?

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Copy of USERS.mdb")

Dim con1 As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Final Database.mdb")

Dim forecolor As Color

Dim objcmd As New Data.OleDb.OleDbCommand

Dim objcmd1 As New Data.OleDb.OleDbCommand

Dim objrdr As Data.OleDb.OleDbDataReader

Dim objrdr1 As Data.OleDb.OleDbDataReader

If objrdr.HasRows Then

Do While (objrdr.GetValue(0))


If (DataGridView1.DataMember.ToString) = (DataGridView2.DataMember.ToString) Then

Dim instance As DataGridViewCellStyle

Dim value As Color

instance.ForeColor = Color.Green

End If


Loop

End If

End Sub

This article has been dead for over six months. Start a new discussion instead.