Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts

Wednesday, March 21, 2012

Open SqlCeConnection from an ASP.NET Web Service?

Help!

I am trying to implement a web service that creates and populates a SQL Mobile database file, then returns the created database to a mobile device as a byte array. The database size could be in excess of 500,000 rows, which is why I want to do as much of this preprocessing on the server before it gets to the mobile device. I can't use replication since I have to do some shaping of the data before I can use it on the mobile device.

Unfortunately, the web service is throwing the following exception when I try to instantiate a SqlCeConnection object:

"System.NotSupportedException: SQL Server Everywhere Edition is not intended for ASP.NET development."

Are there any suggestions as to how I can get around this potential limitation? If I refactor out the code that actually performs the SqlCe operations to a separate assembly, but still call that assembly from within the ASP.NET process, will I get the same error?

I know that you can work with Sql Mobile databases from the deskop, and I suppose I could invoke a console application to create the database, but that seems like such a hack.

Thanks for any advice,

Matthew

This limitation was built into the SQL Everywhere engine because it is supposed to be used as an embedded database (running in-proc with your application), and not in a client-server scenario. The engine will actually test if there are any IIS processes in the calling stack (not sure about the terminology here), so you are out of luck.

Maybe someone smarter than me has a solution - I would also love to know it.

|||

I can understand the reasoning behind that decision; SQL Express is positioned perfectly for that case, but I am definitely not trying to use the SQL Everywhere engine in a client/server scenario.

I am just trying to let a server with significantly more resources pre-build a database for use on a mobile device, then ship the database down to the client. I'd hate to have to write some process that I can "shell" out to from the web app, generate the .sdf file, then read it in by the web service, but I really don't want to if I don't have to. Replication is not really an option, unfortunately.

Thanks,

Matthew

Monday, March 12, 2012

Open database in a connected device

Hi Everybody:

I'm writting an standar application in c# that comunnicates with a sql server 2005 in a mobile device. The mobile device is connected to the pc with an usb wire. In the sample I've made, I've inserted in the form main a datagridview. I go on the wizard to select the data source. I choose a Microsoft SQL Server Mobile Edition data connection. The data source is tge activesync mobile device. I create a new database in the mobile device called test.sdf. The wizard has a button to check the conecttion and it rules. A new connection appears in the server explorer. I add rows through a query. I build the solution and no problem, but when I start the debug session an sqlceexception occurs: Data Source not found. In the database connection that the project has created the connection string is: Data Source ="Mobile Device\test.sdf";

I didn't write any code. I just went on the wizards. All the code has been inserted by visual studio 2005.

Any idea?

Please see this.

|||Thank you very much Ilya. I'll use the windows mobile power toys to get the .sdf file.