Page 1
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
The stored procedures and tables created by
SQL Server are left for another article. We will discuss one table,
conflict_ContactManager_Contact, which is generated by
SQL Server. When the PocketPC database and laptop database are
synchronized, the conflict_ContactManager_Contact table is populated
with all conflicts that occur for the Contact table.
We created four stored procedures to handle
the conflict resolution (Appendix F).
* spGetConflictSummary
* spGetContactByContactID
* spGetContactConflictByContactID
* spResolveContactConflict
The spGetConflictSummary stored procedure
is called to populate the top grid with summary information about
conflicts that occurred. The GUID is stored in the RowData property
for each row. When the client double-clicks the row, the spGetContactConflictByContactID
stored procedure is executed.

The resulting recordset is displayed in the
bottom grid. Each field is displayed on a separate row with the
columns displaying the values for the laptop, the PocketPC, and
the resolution. Conflicting field values are displayed in red.
The client can double-click the value desired to be the resolution.

The client saves the resolution by clicking
the Save button. We call the spResolveContactConflict stored
procedure passing in the values from the Resolution column to
resolve the conflict. The PocketPC can now synchronize with the
laptop database and obtain an updated contact table.
7. Conclusion
We will be investigating several areas for
improving our application as mentioned throughout this article.
In the interim, we hope this article has pinpointed necessary
information for implementing replication and conflict resolution.
In the future, we hope to expand on these ideas and write more
articles detailing our discoveries.
Possible Future Article Topics
- Implementing 802.11B instead of
ActiveSync
- Implementing Microsoft SQL Replication
Conflict Resolver Library
Appendix A: frmMain (PocketPC) Interface

Option Explicit
Private Sub cmdCreate_Click()
Call StartActiveSync()
If (CreateDatabase) then
Call SynchronizeDatabase()
End If
Call StopActiveSync()
End Sub
Private Sub cmdSave_Click()
Call SaveContact()
End Sub
Private Sub cmdSynchronize_Click()
Call StartActiveSync()
Call SynchronizeDatabase()
Call GetContacts()
Call StopActiveSync()
End Sub
Private Sub Form_OKClick()
Call frmMain.Hide
App.End
End Sub
Private Sub cboContacts_Click()
Call _
GetContact(cboContacts.ItemData(cboContacts.ListIndex))
End Sub
Private Sub GetContact(sID As String)
'Code to instantiate the connection, recordset, etc
'has been omitted
'We start here with the recordset being returned
' and after verifying
'only one record
Dim sSQL As String
sSQL = "SELECT * FROM Contact WHERE ContactID
= '" _
& sID & "'"
txtFirstName.Text = rs.Fields("FirstName").Value
txtMiddleName.Text = rs.Fields("MiddleName").Value
txtLastName.Text = rs.Fields("LastName").Value
txtNotes.Text = rs.Fields("Notes").Value
rs.Close
Set rs = Nothing
End Sub
Private Sub GetContacts()
'Code to instantiate the connection, recordset, etc
' has been omitted
'We start here with the recordset being returned
rs.MoveFirst
Do While Not rs.EOF
cboContacts.AddItem(ConcatenateName(rs.Fields
("FirstName").Value, _
rs.Fields("MiddleName").Value, _
rs.Fields("LastName").Value))
ReDim Preserve gasContacts(i + 1)
gasContacts(i) = CStr(rs.Fields("ContactID").Value)
i = i + 1
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
Previous Page
Next Page