2 Replies - 630 Views - Last Post: 29 November 2012 - 06:06 PM Rate Topic: -----

#1 WabiSabi  Icon User is offline

  • D.I.C Head

Reputation: 51
  • View blog
  • Posts: 202
  • Joined: 31-December 10

How to: Add a Database to a Device Project

Posted 29 November 2012 - 02:21 PM

I'm trying to add an existing database to my C# mobile device project. The database I must use is not a Compact database. I can add a Microsoft SQL Server (SqlClient) data source to the project and the query will run fine on my computer. And I can run the program on my device, until I try to run the query. Then I get an error, pretty much like this:
SqlException
   at System.Data.SqlClient.SqlConnection.onerror(SqlException exception, TdsParserState state)
   at System.Data.SqlClient.SqlInternalConnection.onerror(SqlException exception, TdsParserState state)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(Runbehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
at System.Data.SqlClient.SqlInternalConnection.Login(Int32 timeout)
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, Commandbehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, Commandbehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable data Table)



Can you use a Microsoft SQL Server (SqlClient) data source for a mobile app, or does it have to be a SQL Server Compact 3.5 database?

This link shows how to add a Compact database to a project but I can't use it because ours is not a Compact database.

http://msdn.microsof...v=vs.90%29.aspx

edit: as usual, a minute after posting a question, I find an answer.

Apparently Microsoft doesn’t want you to be able to do anything! Ugh…

"SQL Server Compact 3.5 does not support opening database files on a network share."
http://msdn.microsof...v=vs.90%29.aspx

So, is there another version of SQL Server Compact that DOES support opening database files on a network share?

This post has been edited by WabiSabi: 29 November 2012 - 02:29 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to: Add a Database to a Device Project

#2 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1012
  • View blog
  • Posts: 2,444
  • Joined: 04-October 09

Re: How to: Add a Database to a Device Project

Posted 29 November 2012 - 06:04 PM

What they want you to do is create web services to access your database, and use those on your mobile app.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,466
  • Joined: 05-May 12

Re: How to: Add a Database to a Device Project

Posted 29 November 2012 - 06:06 PM

If I recall correctly, Microsoft's preferred solution used to be that you run the Compact edition on the device, and setup replication between the Compact database and the full blown database. That was at the time before Windows 8 when MS didn't believe that mobile devices should be connected to the network all the time. Obviously, with the release of Windows 8, there has been a paradigm shift where the Internet is assumed to be ubiquitous. I don't know if there a corresponding change in the database products.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1