PDA

Click to See Complete Forum and Search --> : Connection String Error


James-R
Dec 23rd, 2006, 07:37 AM
I am trying to make a program for a WM5 Pocket PC.

I want it to use an access db for storing all the data when I tried this:

Dim sqlCon As New Data.SqlClient.SqlConnection()
sqlCon.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=ProStudent.mdb"
'sqlCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\ProStudent.mdb;"
sqlCon.Open()


It said that there was an option error with the connection string.

What am i doing wrong? / What connection string should I use ?

techgnome
Dec 23rd, 2006, 09:32 AM
You're using the wrong data access classes..... SQLClient is ONLY, I repeat ONLY for SQL Server. If you are trying to access an Access databse, use the OLEDBClient namespace. And use the JEt driver, not the access driver.

-tg

petevick
Dec 24th, 2006, 02:53 AM
Hi,
you can't access an access database directly from PPC - your options are SqlClient to access SqlServer or SqlCEClient to access SqlMobile on the device.
There is an article here (http://samples.gotdotnet.com/quickstart/CompactFramework/) on accessing a database on the PPC and here (http://www.devbuzz.com/content/zinc_sqlclient_remote_sql_server_pg1.asp) on accessing SqlServer from your PPC.

There are 3rd party solutions to access MDB's from the PPC, including 1 from my company, SqlLinkCE (http://www.gui-innovations.com/html/sqllinkce.html)

Pete