WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button

Developing Pocket PC Apps with SQL Server CE
Pages: 1, 2, 3, 4, 5, 6

When a particular bookstore is selected, its corresponding order is then listed on the second ListBox control.


Private Sub cboStoreIDs_SelectedIndexChanged( _
  ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles cboStoreIDs.SelectedIndexChanged
    '---displays the orders of store selected
    conn.Open()
    Dim sql As String = _
      "SELECT * FROM Orders WHERE storeID=" & _
      cboStoreIDs.Items(cboStoreIDs.SelectedIndex)
    Dim cmd As New SqlCeCommand(sql, conn)
    Dim reader As SqlCeDataReader = _
      cmd.ExecuteReader()
    '---clears the listbox
    cboOrders.Items.Clear()
    While reader.Read()
        cboOrders.Items.Add( _
          reader.Item("title_id") & " - " & _
          reader.Item("qty") & "-copy(ies)")
    End While
    conn.Close()
End Sub

Figure 8: Viewing the Orders

Oh, one last thing. You may notice that the bottom of our form does not contain the virtual keyboard. This is not easily noticeable if you are using the emulator. But when testing using a real device, you may be stumped when you need to key in the search title. Don't worry; to ensure that the virtual keyboard is displayed, simply add an empty menu bar to your form. And of course, do not forget to shift the controls up a little, or else the tab will not be seen (as it is covered by the virtual keyboard)!

Using the SQL Server CE Query Analyzer

Phew! If you have been following closely, you should be able to get the application up and running, albeit with some little trips here and there. As the SDE is still in Beta 1, there are some rough spots that I have encountered when testing the application. The most common problem is when the Web service does not work -- you click on the Search button but there is no response from the Web service. I noticed one way to detect if the Web service is responding: when the Search button is clicked, you will notice that the Output window will show messages indicating that some threads have exited:


Figure 9: Detecting if a Web service is called

If no such messages are displayed, it is then likely that the Web service is not called. In this case, simply stop your application and start again.

Pages: 1, 2, 3, 4, 5, 6

Next Pagearrow