Skip to main content

Articles

News

Windows Mobile Developer Controls
Sapphire Soltuions

Use eVB and ADOXCE to build an Enterprise Manager for MS SQL Server for CE.

Written by Timothy Chaffee  [author's bio]  [read 56223 times]
Edited by Derek

Page 1  Page 2  Page 3  Page 4  Page 5 


Figure 6 - Database Properties

Display the properties by looping through the connection properties and the Provider specific properties in the properties collection. Listing 5 shows the code used to do this. Looking at the ADOCE, not ADOXCE, Connection object to figure out the standard properties and add them to the ListView. The Set liList = lvwDisplay.ListItems.Add(, , "ConnectionString") statement sets the Property Name column in the ListView. The interesting part is when the actual value is pulled from the Connection as seen here, liList.SubItems(1) = mcatCurrent.ActiveConnection.connectionstring

The other interesting piece of code, shown in the last part of Listing 5, is the loop going through that dynamic properties collection. This is necessary to get all of the dynamic provider properties such as 'SSCE:Max Buffer Size'. Currently when the EntManager project is run it shows 24 dynamic properties in the properties collection on the connection object. Displaying a Table or Column would be a very similar process and is implemented in the EntManager sample project. In its current form EntManager does not display any information from a Tables, Indexes or Keys collection. A good exercise in using ADOXCE would be to add this functionality to the project.

Listing 5 - Display DB Properties

AddListHeaders Array("Property", "Value"), Array("2500", "10000")
Set liList = lvwDisplay.ListItems.Add(, , "ConnectionString")
liList.SubItems(1) = mcatCurrent.ActiveConnection.connectionstring
Set liList = lvwDisplay.ListItems.Add(, , "Attributes")
liList.SubItems(1) = mcatCurrent.ActiveConnection.Attributes
Set liList = lvwDisplay.ListItems.Add(, , "CursorLocation")
liList.SubItems(1) = mcatCurrent.ActiveConnection.CursorLocation
Set liList = lvwDisplay.ListItems.Add(, , "IsolationLevel")
liList.SubItems(1) = mcatCurrent.ActiveConnection.IsolationLevel
Set liList = lvwDisplay.ListItems.Add(, , "Mode")
liList.SubItems(1) = mcatCurrent.ActiveConnection.Mode
Set liList = lvwDisplay.ListItems.Add(, , "Provider")
liList.SubItems(1) = mcatCurrent.ActiveConnection.Provider
Set liList = lvwDisplay.ListItems.Add(, , "State")
liList.SubItems(1) = mcatCurrent.ActiveConnection.State
Set liList = lvwDisplay.ListItems.Add(, , "Version")
liList.SubItems(1) = mcatCurrent.ActiveConnection.Version
lvwDisplay.ListItems.Add , , "Properties Collection:"

For Each oProp In mcatCurrent.ActiveConnection.Properties
Set liList = lvwDisplay.ListItems.Add(, , " " & oProp.Name)
' can't get value for encryption PW or DB PW so need to skip
If oProp.Name <> "SSCE:Encrypt Database" And oProp.Name <> "SSCE:Database Password" Then
liList.SubItems(1) = oProp.Value
End If
Next

This article only touches on a few aspects of ADOXCE programming. It does not even get into creating or modifying databases and tables. Creating a full-fledged Enterprise manager for SSCE would be quite an undertaking. Look through the source code to see a function (CreateDatabase) that shows what needs to be done to create a very simple database. As far as modifying a database or a table, that will be left for the next article. Make sure and check the Microsoft Knowledge Base (KB) at http://msdn.microsoft.com/search before starting. Listing 6 shows a list of KB articles that pertain to SSCE.

Listing 6 - SSCE Knowledge Base Articles

1. 53% Q271931 - INFO: Using Multiple Recordsets for Performance with SQL Server CE Database
http:// support.microsoft.com / support / kb / articles / Q271 / 9 / 31.ASP
2. 53% Q272210 - INFO: System Tables in SQL Server CE Database
http:// support.microsoft.com / support / kb / articles / Q272 / 2 / 10.ASP
3. 53% Q279761 - HOWTO: Use the ADOCE 3.1 Seek Method with SQL Server CE
http:// support.microsoft.com / support / kb / articles / Q279 / 7 / 61.ASP
4. 50% Q280352 - HOWTO: Install SQL Server CE from the Command Line and Generate a Log File
http:// support.microsoft.com / support / kb / articles / Q280 / 3 / 52.ASP
5. 50% Q286357 - FIX: SQL Server CE Refresh Fixes GUID Generation Problems
http:// support.microsoft.com / support / kb / articles / Q286 / 3 / 57.ASP
6. 33% Q272067 - HOWTO: How to Get Record Count from a SQL Server CE Recordset
http:// support.microsoft.com / support / kb / articles / Q272 / 0 / 67.ASP
7. 33% Q273580 - HOWTO: Look Up Error Codes Related to SQL Server CE
http:// support.microsoft.com / support / kb / articles / Q273 / 5 / 80.ASP
8. 33% Q274112 - INFO: SQL Server CE Performance Tips and Efficient Memory Handling
http:// support.microsoft.com / support / kb / articles / Q274 / 1 / 12.ASP
9. 33% Q280082 - PRB: SQL Server CE Queries with WHERE and ORDER BY Clauses May Run Slow
http:// support.microsoft.com / support / kb / articles / Q280 / 0 / 82.ASP
10. 33% Q281213 - PRB: SQL Server CE Setup on Windows 2000 Error Message: The Installer Was Interrupted
http:// support.microsoft.com / support / kb / articles / Q281 / 2 / 13.ASP
11. 33% Q270896 - INFO: SQL Server CE Query Analyzer Does Not Display Descriptive Data Type
http:// support.microsoft.com / support / kb / articles / Q270 / 8 / 96.ASP
12. 33% Q271592 - INFO: Cannot Create a SQL Server CE Database on Connection.Execute
http:// support.microsoft.com / support / kb / articles / Q271 / 5 / 92.ASP
13. 33% Q274255 - PRB: ADOXCE Error Message: "..Specified type was invalid" for SQL Server CE Table
http:// support.microsoft.com / support / kb / articles / Q274 / 2 / 55.ASP
14. 33% Q276985 - HOWTO: Use SQL Server CE OLE DB Provider-Specific Properties in eVB
http:// support.microsoft.com / support / kb / articles / Q276 / 9 / 85.ASP
15. 33% Q279552 - HOWTO: Delete a SQL Server CE Database in an Application
http:// support.microsoft.com / support / kb / articles / Q279 / 5 / 52.ASP
16. 33% Q280514 - HOWTO: Use AppendChunk and GetChunk with NText Columns in a SQL Server CE Database
http:// support.microsoft.com / support / kb / articles / Q280 / 5 / 14.ASP
17. 33% Q283844 - BUG: DATEADD Does Not Accept Scientific Notation for the NUMBER Argument
http:// support.microsoft.com / support / kb / articles / Q283 / 8 / 44.ASP
18. 33% Q285854 - PRB: Application Error Occurs When You Run Two Instances of Replication or RDA Application on HPC Pro
http:// support.microsoft.com / support / kb / articles / Q285 / 8 / 54.ASP

Author Bio
Timothy S. Chaffee
Tim is currently Vice President of Application Architecture for Object DesignWorks, a Microsoft Embedded Partner. For the past five years he has been working in the area of software design and architecture and has successfully designed, developed and implemented many Windows DNA solutions. Before turning his attention to distributed computing, Tim was a network engineer for over eight years and managed networks exceeding 20,000 nodes. Tim is currently a MCSD, MCT and a Novell CNA. You can reach Tim at tchaffee@objectdesignworks.com

Previous Page

Previous Page