SQL access from a Windows 10 Universal Application - sql-server

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?

AFAIK you can't directly connect to a full blown SQL DB from a WUA. Only to an SQLite one.
Similar question with more detailed answers-
Universal store app getting data from server

There is a class called SqlConnection which you can use to connect to a database that does the same thing.
Here is an example I found in msdn.
SqlConnection sqlCon = new SqlConnection("Data Source=(local);Initial Catalog=Test;Integrated Security =SSPI;");
Or you can create your own api on your server and connect to it using ajax methods like XMLHttpRequest().open('GET','stuff.aspx',true)

Related

SQL connection in UWP app

I have am existing project that runs on windows, mac, ios and android. I'm looking for a way to make a windows phone version, but I can't figure out how to use SQL. My current code base is very large and I can't "switch" to using EF. How can I get access to databases in UWP?
If you want to connect a local database, for example the SQLite, there are implemented libraries could be used do this stuff:
A Developer's Guide to Windows 10: (10) SQLite Local Database
If you want to connect a server-based database, for example, the SQL Server database, unfortunately, there is not a built-in API like ADO.NET that could be used to connect the SQL Server directly. And for a workaround, you would have to utilize a middle layer for example, the WCF Serrvie:
How to access data from SQL Server database in Windows Store app, although this sample is written for store app, the used approach is the same for UWP application.
You'll not be able to connect directly to a Microsoft SQL Server database. Instead you'll need to make some type of Service layer that communicates with the database and your phone app would need to communicate with that. For more information on how to do that see the code same and the video that Microsoft has hosted here:
https://code.msdn.microsoft.com/windowsapps/How-to-access-data-from-5f2602ec

How to deploy C# winForm(EntityFramwork) application on LAN network

There are dozens of questions like this but none of them resolve this issue.
I have created WinForm application using entityFramework modelFirst approach. I have deployed it using InstallShield and it works perfectly fine.
I have been using VisualStudio server explorer for all database related work, not SQL server Management studio.
Questions
What I simply want is how can I make its database centralised
through out the LAN network?
One computer will act as server and
will contain that application too, others will just have application
and use database from server. Do I have to make two builds? or what
do I do?
In-case of change in IP address of server of location of
database at server? Shall it require new deployment or just some
changes in connection string?
Shall it require some changes in code
as well to handle exceptions in case of server no-response or
anything?
Kindly elabore with steps and process, whatever you are suggesting as I am very new to this.
The general way to do this is to have a ConnectionString that points to the machine running the server. The machine name is used, not the IP address.

SQL Server Integrated Security with ASP Classic

I'm working with getting a legacy app in line with current SQL Server security standards at my organization and would like the application to use Windows authentication when making SQL Server stored procedure calls from an ASP classic app runniing on a Windows Server 2008 web server. If it's too much trouble I can create a SQL Server account but would like to use integrated security. I'm looking for the best practice with this type of configuration. Any help is greatly appreciated.
By ASP side it should be easy, it's a matter of connection string.
Try this one:
strConn="Driver={SQL Server}; Server=[YOUR HOST]; Database=[YOUR DB]; Trusted_Connection=Yes;"
Before that, you have to properly configure IIS

Hosted VB.Net Application with SQL Server Database & Filesharing?

A company I work for has an application written in VB.net with a SQL Server database storing all information. Works fine no complaints, but we also want to upload/download files within the application, and have the files + SQL Server database on a remote server i.e. working over the internet.
We could just use a VPN but that's not the best method. What would you suggest we use to communicate securely between the application and the remote server for both the database and filesharing?
I was thinking of doing everything over HTTPS, but we would need some kind of agent on the other end to receive requests.
Sorry if this is a noob question, I have no experience with VB.net myself, I usually use PHP + C!
Thanks
Use a VPN. It implies just deployment and configuration.
'Going over HTTPS' means you rewrite your application, as the current VB app is expecting T-SQL and SMB endpoints to discuss with.

SQL Server 2008 FileStream on a Web Server

I've been developing a site using ASP.NET MVC, and have decided to use the new SQL Server 2008 FILESTREAM facility to store files 'within' the database rather than as separate entities. While initially working within VS2008 (using a trusted connection to the database), everything was fine and dandy. Issues arose, however, when I shifted the site to IIS7 and changed over to SQL authentication on the database.
It seems that streaming a FILESTREAM doesn't work with SQL authentication, only with Windows authentication. Given this, what is the best practice to follow?
Is there a way to force this sort of thing to work under SQL authentication?
Should I add NETWORK SERVICE as a database user and then use Trusted authentication?
Should I create another user, and run both the IIS site and the database connection under this?
Any other suggestions?
Take a look at this article. I don't know a whole lot about FileStreaming and security, but there are a couple of interesting options in the FileStreaming setup such as allowing remote connections and allow remote clients to access FileStreaming

Resources