From: Luqman on
How to create, read and write in a database in \db folder of Pocket PC,
using VB.Net.

Best Regards,

Luqman



From: The Mad Ape on
On Jan 27, 6:14 am, "Luqman" <pearls...(a)cyber.net.pk> wrote:
> How to create, read and write in a database in \db folder of Pocket PC,
> using VB.Net.
>
> Best Regards,
>
> Luqman

What version of .Net are you using? I use Compact Framework 3.5, MS
SQL Server Compact 2005, VB.Net from VS 2005. Here are some examples:

'create database
Dim engine As New SqlCeEngine("Data Source = \My Documents\" &
txtName.Text & ".sdf")
engine.CreateDatabase()

'open database
Dim ssceconn As New SqlCeConnection("Data Source = \My Documents\" &
txtName.Text & ".sdf")
ssceconn.Open()

'create table
Dim sqlCreateTable As SqlCeCommand = ssceconn.CreateCommand()

sqlCreateTable.CommandText = "CREATE TABLE tblHammer(hd_item int
IDENTITY(1,1) PRIMARY KEY NOT NULL, hd_name NVARCHAR(10) NOT NULL,
hd_swvoltab NVARCHAR(10) NOT NULL, hd_hwvoltab NVARCHAR(10) NOT NULL,
hd_landowner NVARCHAR(20) NOT NULL, hd_cruisetype NVARCHAR(12) NOT
NULL, hd_txt1 numeric(8,2) NOT NULL, hd_txt2 numeric(8,2) NULL,
hd_txt3 numeric(8,2) NULL)"

sqlCreateTable.ExecuteNonQuery()

'now do housekeeping
'close and dispose

engine.Dispose()
engine = Nothing

sqlInsertRow.Dispose()
sqlInsertRow = Nothing

ssceconn.Close()
ssceconn.Dispose()
ssceconn = Nothing

Hope this helps.

Good Luck

The Mad Ape
www.tatumba.com