VB.Net ODBC Database access for Windows Mobile (Pocket PC) - TechRepublic
Question
May 16, 2008 at 03:07 PM
aaroncool

VB.Net ODBC Database access for Windows Mobile (Pocket PC)

by aaroncool . Updated 18 years, 2 months ago

I am trying to use ODBC (Imports System.Data.odbc) to access data from a Microsoft Access database. I am able to use the following code in VB.Net for a Windows Application but when I debug the code in my Windows Mobile Application it cannot recognize ‘Imports Sestem.Data.odbc,’ ‘OdbcConnection,’ ‘OdbcDataReader’ or ‘OdbcCommand.’ How do I get the import to work? Is there another method I can use? Please help, thanks.

******************************************
Dim oODBCConnection As OdbcConnection
Dim sConnString As String = _
“Driver={Microsoft Access Driver (*.mdb)};” & _
“Dbq=C:\Test.mdb;” & _
“Pwd=Password”
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

Dim odr As OdbcDataReader
Dim cmd As New OdbcCommand()
cmd.Connection = oODBCConnection

cmd.CommandText = “SELECT * FROM Log”

odr = cmd.ExecuteReader()

odr.Read()

MsgBox(odr(“LogID”).ToString())

This discussion is locked

All Comments