Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

eVB (eMbedded Visual Basic) and ADOCE Recordset bookmarks in Pocket PC databases.

Written by Carole Mitchell  [author's bio]  [read 46063 times]
Edited by Derek

Page 1  Page 2 

If you are wondering how to go about creating a bookmark within ADOCE, you have come to the right place. I am going to very quickly show you how to create a basic bookmark and I am going to use the basic code template used in the article 'Intro to Pocket PC databases'. To use some more meaningful data let us make a few minor modifications to the table and column names.

If you haven't already read the article 'Intro to Pocket PC databases' located on the deVBuzz.com home page, go there now and and download the code to do that tutorial. This will download an eMbedded visual basic project to your desktop, that allows you to create a database and a table on your pocket pc, as well as insert and list rows in the table. Open the project and do a search for the table name 'TestTable' and replace it with 'CustomerTable'. In the subroutine 'cmdCreateTbl_Click' paste the following code :

Private Sub cmdCreateTbl_Click()
ExecSQL "CREATE table CustomerTable
(CustName Varchar(200), CustAddress varchar(255),
CustCity varchar(100) )", "CustomerTable created.",
"Err: CustomerTable was not created."
End Sub

So now we will have a CustomerTable with three columns : customer name (custName), customer address (custAddress), and customer city (custCity).
Change the code in the 'Insert Rows' command button to read as follows :

Private Sub cmdInsertRows_Click()
   Dim rs As ADOCE.Recordset
   Dim arb1 As Integer
   If connOpen = True Then
      Set rs = CreateObject("ADOCE.Recordset.3.0")
      On Error Resume Next
      rs.Open "CustomerTable", conn, adOpenKeyset, adLockOptimistic
      For arb1 = 1 To 5
        rs.AddNew
        rs.Fields("CustName") = "Customer" & CStr(arb1)
        rs.Fields("CustAddress") = "Customer" & CStr(arb1) & " address"
        rs.Fields("CustCity") = "Customer" & CStr(arb1) & " city"
        rs.Update
      Next
      If conn.Errors.Count = 0 Then
        txtDB.Text = CStr(rs.RecordCount) & " rows were added to
        CustomerTable."
      Else
        DispErrors
        txtDB.Text = "There were errors adding rows to CustomerTable."
      End If
      On Error GoTo 0
      rs.Close
      connClose
    End If
End Sub

Next Page