Showing posts with label sdf. Show all posts
Showing posts with label sdf. Show all posts

Sunday, March 25, 2012

Connecting to SQL Mobile within VS-2005

I am getting an error when I run my project within VS2005. I am trying to connect to a SQL Mobile (sdf) file thru code using a connection string. As soon as run my project within the VS2005 environment, I get the following error when the code tries to connect:
"The file is not a valid database file. An internal error has occurred. [,,,Databasename,,]"
The source of the error is: Microsoft SQL Server 2000 Windows CE Edition
Native Error of: 25011
I am am deploying to POcket PC 2003 SE Emulator.
This code worked fine in VS2003 with SQLCE 2.0. But I have now updated the projects to VS2005 and recreated the database sdf file within the VS2005 environment.
Could someone please help me ASAP?
Thanks.

There is no database compatibility between SQL CE 2.0 and SQL Mobile. Database created through one cannot be opened by other. In you case, since you have upgraded the project and re-created the database, you have SQL Mobile database. But your application still has references to SQL CE 2.0 provider. So now your application is trying to open a SQL CE 3.0 Database using SQL CE 2.0 provider; that’s the reason why in your error string you can see

The source of the error is: Microsoft SQL Server 2000 Windows CE Edition
Native Error of: 25011

In you application you need to remove the reference from 2.0 provider and add reference to 3.0 provider.

Thanks

-Mani

Sunday, February 19, 2012

Connecting Database Engine (SQl server 2005 file .*mdf) from Win CE 5.0 platform

Is this possible to connect do the Database Engine (on sql server 2005 on XP platorm - file *.mdf (not mobile *.sdf)) from win CE 5.0?

I tried to do this :

ConnectionStringSQLServerCE = "Data Source=WORK_STATION\\SQLEXPRESS;Initial Catalog=dbMachines;Integrated Security=False;Password=Panel;User ID=Panel";

SqlCeConnectionCE = new SqlConnection(ConnectionStringSQLServerCE);

SqlCeConnectionCE.Open();

but I catch error:

catch (PlatformNotSupportedException ex)

?PlatformNotSupportedException”

I noticed that I see server because when I use:

ConnectionStringSQLServerCE = "Data Source=WORK_STATION\\SQLEXPRESS";

zwraca b??d typu

catch (SqlException ex)

“Login failed for user ''. The user is not associated with a trusted SQL Server connection.”

I used

using System.Data.SqlClient;

from Compact Framework 2.0 under Visual Studio 2005 Device Application Windows CE 5.0

can anyone help me?

Yes, it is possible to connect to SQL Server 2000/2005, SQL Express and MSDE from NETCF application using SQL Client.

PlatformNotSupportedException usually happens if particular device does not support locale database it in. For example, if your database uses Polish collation, you'd need device localized in Polish in order to use it. Alternatively you could change database collation to one available on device.

As to connection issue, your server need to be properly configured and you should have functional network connectivity. Please see this for general troubleshooting:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=335660&SiteID=1