質問

In researching bugs, I often need to quickly see what data actually exists in the SQL Server CE database on the handheld device. Due to the tedious nature of keying in SQL statements on the device itself, how can I quickly run SQL statements to determine what the results from my Windows CE app should be?

役に立ちましたか?

解決

Connect the device via ActiveSync/WMDC, and connect to the database from SSMS 2008 R2, and you can Query from SSMS on your PC. If you use SQL Ce 2.0, you can use the Primeworks tools to access the database on the device, if it is 3.1, you can use SSMS 2005 SP2

他のヒント

Follow these steps to do so:

0) Write the SQL statement in a text file on your dev machine, such as:

SELECT COUNT(*) FROM VENDOR_ITEMS WHERE VENDOR_ID = 'Big Honkin Harry'

1) Save it as BigHonkinHarry.txt (or whatever, but future steps assume that name)

2) In Windows Explorer, select BigHonkinHarry.txt and copy it

2) Still in Windows Explorer, locate your handheld device (such as "WindowsCE", or whatever it was named), expand it so that it displays its "subfolders" and from there select the root ("\"). There you should see a "My Documents" folder; highlight "My Documents", right-click, and select Paste; this should copy BigHonkinHarry.txt beneath the handheld's My Documents folder.

3) On the handheld device, open the "My Documents" folder

4) Locate BigHonkinHarry.txt and 2-click it

5) Select Edit > Select All

6) Select Edit > Copy

7) Select File > Close

8) 2-click your database (such as "DuckbillDB42"); this should open SQL Server CE Query Analyzer

9) Mash the SQL button

10) Mash the "Paste" toolbar button (penultimate button, with the clipboard/document icon); now your query will be in the SQL pane

11) Mash the green arrow button; this will run the SQL statement and give you some feedback, such as:

87 gazillion rows affected
Elapsed time 00:42:17

12) Mash the Grid button to see the actual results

Voila!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top