Windows CE - Database - vb.net

I need to setup an application to scan a barcode from a packing slip and the associated fulfillment items on a windows CE 5.0 device and update the inventory on the server. I'm using VB.NET. However, what is the best way to interact with the database? Integration Services, ADO.NET, RDA... etc... it's a bit overwhelming trying to figure out what I should use to interact with the database. It's currently an Access database, but I imagine I'm probably going to need to migrate it to SQL Server or SQL Server Express.
I'd also need to print the packing slip to a network printer from the device. Is there any way to do this?

Sql CE is an excellent choice if your devices have to function for stretches in a disconnected state (i.e. not connected to the server). If you do use Sql CE, however, I strongly recommend not using RDA to persist local changes back to the server database (see this answer). In any event, RDA merge replication would require your server database to be Sql Server.
If your devices are always connected to the server through a wireless network, then you do not need a local database on the devices at all. Your devices can upload and download data through ASP.Net web services running on the server. Using DataSets for this communication is a good choice, since they are essentially database-agnostic (and thus your PDA code won't particularly care what database you're using on the server).
The web service approach will also let you handle the printing requirement. The PDA would send the relevant information to a web service method, which would then handle printing to the network printer.

My recommendation is to use SQL Server Compact edition (http://www.microsoft.com/Sqlserver/2008/en/us/compact.aspx) for storage engine, and ADO.net implementation of SqlCe in System.Data.SqlServerCe namespace (http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.aspx) for code interaction. They are very well integrated with Visual Studio 2008, including designer support of strong-type dataset and run-time examination of data content on device etc.
No idea about the printing.

In all today scenarios, I would recommend using SQLite. It is the most used database today. Don't bind yourself to an database ecosystem. Just go here and search for "Precompiled Binaries for Windows CE (.NET Compact Framework)". Then you have a SQLite.Interop.*.dll and the System.Data.SQLite.dll. The SQLite.Interop.*.dll has to be placed and deployed besides your EXE file. The System.Data.SQLite.dll is the managed wrapper, that you have to reference in your project. Example: Create SQLite Database and table
SQL Server Compact is not compatible to most mobile platforms like iOS, Android and so on. Microsofts support for old target platforms is poor, leaving Windows CE with only SQL Server Compact 3.5 SP2 where you don't have some essential SQL functions like "LIMIT". Databases generated on the Desktop OS (> Windows XP) will also need to be converted on the device (long delay, when you first open the database), because MS is using different code pages on desktop and Windows CE.
This is Microsofts statement about RDA:
Because of design limitations, remote data access (RDA) will be removed in a future release. If you are currently using RDA, you should consider transitioning to Microsoft Synchronization Services for ADO.NET. If you were planning to use RDA in a new application, you should instead consider merge replication or Sync Services. Note that Sync Services is currently available only for the Windows Desktop Operating System.
Best way to interact with the database is just build the database on the server, compress it als deflate (available under both Desktop and Compact via System.IO.Compression) and send it to the device in whole. Plain and stupid. Most devices have poor import performance, so doing the import locally may take too much time, even if you have a fancy sync framework.
To transfer the database you can use a WCF service or just any web server using a HTTPS GET. Like so:
// ppp_peer is in most cases the active sync connected pc
string url = #"https://ppp_peer/export/database.db.gz";
string html = string.Empty;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (FileStream fs = new FileStream(stream))
{
// Decompress your database here
}
To ORM your POCO objects just use something like https://bitbucket.org/twincoders/sqlite-net-extensions
However, if you have WLAN access everywhere, I would consider writing a browser application and using the mobile browser together with a web server for your needs. Just keep in mind, that Windows CE 5 based devices don't come with HTML 5 support out of the box. If you have a choice consider switching to a Android based device.

Related

How can I built a standalone windows desktop application ,where I don't need to install any server additionally on client's machine?

I am developing desktop app using wpf mvvm,however I am confused as to how should I proceed with developing standalone application using sqlite,sql server compact etc
If you need a database (really need a database), I suggest using Entity Framework using the code first approach. This can create a local database for the application w/o the need of a database server.
However, strongly consider if you could just use files in the file system. It is amazing how much you can load into memory and if you want this to run on client machine, you likely don't have so much data that you can't just load the data into memory.
SQL Server Compact requires a separate installation step with administrative credentials.
SQLite is a library that can be compiled directly into the application.
In the case of .NET, it is a part of the System.Data.SQLite package, so it is automatically available when your application is shipped with this package (see SQLite deployment for .net application).

How to move a windows .net runtime frontend application to the cloud (it uses a local sql server backend database)

I had a engineer design our .net application back in 2009, my guess is that it was coded using visual studio, and all I have is the installer application. We have been using it on our 1 or 2 local client machines very well for the past few years, but now I want to move this front end to the cloud. Instead of installing it as an application on our windows 7 machines.
It is a very simple application used in our small warehouse that keeps track of cargo/shipments etc. It uses Sql Server 2008 Express as a backend which is stored locally.
I know how to get the database in the cloud, their are many options for that, using Amazon or Azure, but how do i get the local client application to the cloud?
I dont have access to the visual studio code, i just have the runtime executable file..
I am sure there is no way to do this, and many of SO users will say i need to re-write the front end.
I have tried to contact the developer and they hav since closed down. Is their anyway i can run this in the cloud?
I welcome all options and solutions!
Thanks.
I believe you have two options for hosting this application:
If you are able to configure the database connection string, you could host the database in the cloud, and distribute the application to your end users. However, you've already stated that you know how to move the database, so I assume this isn't an option.
The only alternative is to run the entire application on a cloud server, and send the user interface to a client using terminal services. This makes it appear as if the application is running locally on the user's computer, while it is actually running on the server.
For an off-the-shelf solution to achieve this, you could consider using Microsoft's RemoteApp Azure service. I'm sure there are other similar offerings available.

how to use a desktop software without having sql server installed on system?

consider I write a desktop software in C# for example,and it reads/writes data to/from sql server,Can I run this software on a system without having sql server installed.
I saw the two links of stackoverflow,but did not get my answer.
I want to know CAN THAT BE DONE OR NOT?
if yes,how?
thanks in advance.
Sql Server must be installed, and running, somewhere to be able to use it. However, this does not need to be on local machine. The most common scenario for Sql Server is to be installed on a dedicated server machine off in a data center somewhere, and either many clients will connect to and use the same database, or one or a few web servers will connect potentially many times per second with different requests. It's not really intended for desktop use.
If you want to build a desktop app, and you want a database to use only as a local data store, Sql Server is actually a really poor choice for this. That includes the free Sql Server Express. Don't use it for applications that will be distributed to end users, where all the data will kept on each user's local system. It is a server-class engine, and works best when it can run on dedicated hardware.
Instead, you want a desktop-class or in-process database engine, such as Sqlite, Sql Server Compact (not Express) Edition, or even MS Access.
There are many SQL engines that can be embedded in desktop application. For example SQLite, there should be one with C# interoperability.

How to connect to remote database with windowsphone

In my app, I want to read a remote sql database. After spending some hours on searching the net, I found out that this can not be done with sql commands but that it needs a webservice wrapper I.E WCF or ADO.net
Are there (and where) any examples on how to read/write records to a remote database server using windowsphone.
Thanks,
Bart
Your best option will be to use WCF Data Services with an AD.NET Entity Framework model (there even is a client for Windows Phone). Beware that the Windows Phone client by default does not use compression and does not use the compact json format. UPDATE: Latest client/server parts now use json with Windows Phone

Develop for SQL Server Standard using SQL Server Express?

I'm working on a web service project, and I'm coding at home, where I have SQL Express 2008 installed, but the app needs to interface with an SQL Server Standard. I've never done the transition before, and I haven't been able to find any resources on the subject - plenty of stuff about upgrading, but nothing about how to deploy.
For instance, Visual C# Express, I don't seem to be able to connect to a database without a database file - is that how Standard works as well? Do I just deploy the file with the application?
You can use the Express version also as a stand-alone installation. See here for example. In fact, there is also a free edition of Management Studio. You can manage your database the same way as any other edition. If you install SQL server express in this way, you can move to another version of SQL server without a hitch!
Unless you are doing something very very unusual or something hacky, the deployment will be very easy. Anything that I know of that you can do in the Express version works exactly the same in the full version.
All different ways of connecting to the database are available in both the Express version and full version. You don't need any database file to make a connection, unless the framework that you use requires it. You always connect to the database server through the network, never through the file system.
When you deploy the application you just change the connection string so that it points to the live server. If the login is set up the same way on that server, it works without any other changes.
I think you'll have to manually create the connection string as the IDE won't automatically generate ones connecting to SQL Server Standard Edition. But you can easily record two in the app - one for testing that points to the EXPRESS instance, and one for the live that points to the real one. As long as you're connecting to the same objects and interacting with them in the same way, it should be fine.
You can manually amend your connection string AFTER the IDE has generated its own to something like :
Data Source=ServerName;Initial Catalog=AppDatabase;Integrated Security=True;Persist Security Info=True;Connect Timeout=30
replacing ServerName and AppDatabase as required, and with possible authentication changes. You'll have to watch for the IDE recreating the original connection string, though, as I can't see a way to modify the connection string used in the Database Explorer and if you use the IDE to drag datasources into your app it'll keep using the original connection string.
SQL Server Developer Editions are pretty cheap, though - easily less than £50.