Search code examples
ms-accesswindows-ce

Windows CE Application - Microsoft Access Database


I have an application developed on Microsoft Access (.accdb) to manage stocks and i like to develop an module to use a data collector that runs a windows CE 5.0. So I started to develop in .net (VS 2008) the screen to make the stocks movimentation like expedition. At the moment that I try to connect to database the VS give me an error telling me that is not possible make the connection, but when I test the connection, the connection is sucessfull.

I just want make simple operations like select and update the values in database.

Is there any way to make the connection?

I found something, but all of those solutions use SQL / SQLCe.

The code that I Try

Imports System.Data.OleDb

Public Class Form1

Public OleDb As OleDbConnection

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim dbComm As OleDbCommand = OleDb.CreateCommand()
    dbComm.CommandText = "SELECT * FROM CLIENTE WHERE CLI_ID = @P0"
    dbComm.Parameters.AddWithValue("@P0", TextBox1.Text)
    Dim dr As OleDbDataReader = dbComm.ExecuteReader()
    dr.Read()
    Label2.Text = dr("CLI_NOME").ToString()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    OleDb = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\db.accdb;")
    OleDb.Open()
End Sub

End Class

Give me an error on the first line after I put the Imports System.Data.OleDb

Error: Warning 1 Namespace or type specified in the Imports 'System.Data.OleDb' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.


Solution

  • So your trying to run this code on Windows CE 5.0, presumably using .Net Compact Framework 3.5 ?

    • Are you sure that the 'System.Data.OleDb' namespace is supported on that platform?
    • Are you sure that the 'Microsoft.ACE.OLEDB.12.0' driver is available on that platform?

    I don't think they are supported or available for this platform. I would say your best bet is to architect the system such that, you run a browser type application on the Windows CE device, and connect to a remote web server, and have that server do the read/writing to the database.