pocketpc and sql

When i first tried to make an sql connection etc i did this with a normal windows application, but then i could just click on the data tool and selected sqlconnection, sqldataset etc etc.. But can this be done when i make a smart device application? i dont have that same tools, so i guess i have to write the code myself, but i have no experience with that..
[360 byte] By [perri] at [2007-12-16]
# 1
It needn't be that difficult, you'll need to setup the objects in code e.g.

Dim cn As New SqlCeConnection()
cn.ConnectionString = "Persist Security Info = False; Data Source='SalesData.sdf';" + _
"Password = '<password>'; File Mode = 'shared read'; " + _
"Max Database Size = 256; Max Buffer Size = 1024"
cn.Open()

etc

Take a look at the code in your desktop app to see what the wizards generated for you - it should be easy then to apply this knowledge to your device code.

Peter

PeterFoot at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 2
Ok thanks, seems like it worked now, and i figured something more out. But i have one more question tho. How can i load the data i get into a listbox? I have the code that use the select statement etc, but i have no ide how to load it into the listbox.. Any example/doc/something you can recommend?
perri at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 3
You have 2 options

- You can loop through the results and load items into the listbox one by one
- Use the IDE!
- Click on Data->Add Data Source
- Select the database and the tables you want to work with
- Click on Data->Show Data Sources
- In the data sources window, select the table you want to work with and change the drop down combo to 'Details'
- Click on the column you want to load into the listbox. Click on the combo arrow and select Listbox from the choice of controls.

Thanks,
Sriram Krishnan
PM, Visual Studio for Devices

SriramKrishnanMSFT at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...