SQL access from a Windows 10 Universal Application

I'm trying to make an application for my company which will run on Windows 10 tablets connected to a main server over the internet via a VPN. I have the VPN and devices established and am trying a sort of "Hello World" with a tablet.

Here is my problem: My app will require access to the SQL Server running on main server hosting the VPN.

The SQL Server is already configured to allow access over the network and has been tested. If I write a simple WPF application, I can run it from the tablet and the SQL connection works perfectly.

So why is it a problem?

Because for the life of me I can't figure out how to connect to an SQL database from a Windows Universal Application. I'm using Visual Studio 2015 and the "Blank App (Universal Windows)" solution template. The System.Data.SqlClient namespace is not available by default, no framework assemblies are listed when I try to add a reference, and when I browse to the System.Data.dll to add it manually, I get other errors.

The above makes me feel like I'm going about this wrong; database access is a basic need for an application and shouldn't be this hard to implement. Can anyone tell me how to go about it?
BROOKLYN1950Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pcelbaCommented:
You have to create a Service layer to access the database. Code sample is available here and noted e.g. here.

You could also think about http(s) access via web browser. The web application created on the server is safer and it can also use more resources like .NET features, code samples, etc.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BROOKLYN1950Author Commented:
Is there really no way to access the database directly? I feel like there has to be some way since I can do it from a WPF application. A service layer sounds like a lot of extra work for such a simple need. I'm not going to be making a web app, in fact I'm actually doing this to switch from a web app to a tablet app.
0
pcelbaCommented:
Simpler way is the web application in this case. If you write web app for the tablet then users don't recognize the difference.

Windows Universal applications were introduced to be multiplatform for various processors and various display sizes thus to use Service layer is the only way today.

Of course, you could write your own SQL Client which is much more complex than to learn Service layer.
0
BROOKLYN1950Author Commented:
I ended up going with a WPF application as opposed to a Universal App, but this is still the correct answer for anyone who doesn't have that option.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.