views:

281

answers:

2

Hi, I have created a database using SQlServer CE with the name of db.sdf using the following code.

Dim connStr As String = "Data Source =\temp\emp.sdf;"
Try
            'creating database
            Dim engine As SqlCeEngine
            engine = New SqlCeEngine(connStr)
            engine.CreateDatabase()
            engine.Dispose()

            'creating table
            Dim cn As New SqlCeConnection(connStr)
            Dim sql As String
            sql = "CREATE TABLE login "
            sql &= "("
            sql &= "    username   nvarchar(20) PRIMARY KEY,"
            sql &= "    password   nvarchar(20)"
            sql &= ")"
            Dim cmd As New SqlCeCommand(sql, cn)
            cmd.Connection.Open()
            cmd.ExecuteNonQuery()
            cmd.Connection.Close()
            cmd.Dispose()
            cn.Dispose()

            MessageBox.Show("Succesfully created")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

But i dont know where it keeps this emp.sdf file and how to view this. I have just started working on VB.NET Pocket PC application today and i am very confuse because my VB.NET connection code is not working as well with Pocket PC application so please help me how to solve this problem. Please any tutorial which can help me. Thanks

A: 

how I creATE A DATABASE WITH EXTENTATION SDF ???'

A: 

You have provided the database name in your connect string when you created the database...

Dim connStr As String = "Data Source =\temp\emp.sdf;"

... so you should find a \temp folder under \My Device that has the emp.sdf file in it.

Bill