Hi,
I have created one table in MySQL database. I want to use that table in my C sharp application through ODBC. I have installed the ODBC driver also. I have created the project in visual C#, Smart device and WINCE 5.0. Now i want my application will interact with table through ODBC.

While including the name space System.Data.Odbc i haven't found the ODBC name space in the Data object. I found only System.Data.Common,System.Data.SqlClient and System.Data.SqlTypes. Without having ODBC name space I can't create a new connection to access the data base. I don't have any idea where the problem is ? Can any body please let me know where the problem is?

Regards,
Vijay Bhaskar

Dani AI

Generated

Short answer: the missing ODBC namespace is because this is a Smart Device / Windows CE project that uses the .NET Compact Framework (CF). The CF does not include the desktop ODBC/OLE DB providers, so you will not find a System.Data.Odbc assembly to add in a Smart Device project.

already showed the symptoms (only System.Data, System.Data.SqlClient, System.Data.SqlTypes visible). ’s pointer to adding a reference is correct for desktop projects, but on CE that assembly simply isn’t part of the runtime. ’s idea of using a server-side .NET MySQL connector is the practical direction: host the DB access on a server (ASP.NET/WCF/REST) where Connector/NET or an ODBC driver is available, and let the device call that service over HTTP. That avoids needing DB drivers on the device and is the most maintainable and secure choice for production.

Options to consider

  • Recommended: build a thin web service on your server that performs MySQL operations and returns JSON/SOAP. The device uses HttpWebRequest/WebClient to call it. Benefits: no native drivers on the device, centralized security, simpler updates.
  • If offline/local DB is required: use a local store on the device (SQL Server Compact if available) and implement sync logic to the MySQL server through a service.
  • Advanced/rare: find or build a native MySQL/ODBC driver compiled for WinCE and P/Invoke it from the device. This is complex, platform-dependent, and usually not worth the effort.

Quick checks

  • Verify the project type and target framework in Project Properties — Smart Device projects target the Compact Framework.
  • Try creating a normal Windows (desktop) project; you’ll see the desktop ODBC assemblies available there.

Security note: never expose MySQL directly over the internet from the device. Use a secured middle tier.

Try to add Reference to project

You have to use System.DataOdbc.OdbcConnection

see

Hi,
Thanks for replying.

Even while adding the reference also it is displaying only following options.

System.Data, System.Data.SqlClient and System.Data.SqlServerCe

Hence i am not able to add any name spaces which are belonging to ODBC.

Can u please provide any other solution if you know.

regards,
Vijay Bhaskar

Try to add Reference to project

You have to use System.DataOdbc.OdbcConnection

see

Use the MySql .net connector 5.2. It is much faster. Numerous samples included.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.