Connecting a Xamarin.Forms App directly to a SQL Server on a LAN

I'm trying to connect a Xamarin.Forms App to a SQL Server and I want it to be able to get data from it. The app isn't going to be connected to the internet, only to a local network. Is there any way I can connect the App directly to the SQL Server?

Answers

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    You can probably connect using the SQLClient, but that's terrible practice.

    You should expose a Service (Web API or similar) on the server on which the database resides, and and then communicate with that Service from the Xamarin.Forms application.

  • XigmondXigmond USMember ✭✭

    its not a good Idea but maybe you have your reasons for doing this ...

    you can use Entity Framework and create your connection as your application context just like what you would do with a web api and you can add/remove/edit your tables as easy as doing so with a list of objects.

Sign In or Register to comment.