Forum General


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

SQL Server CRUD with Variables Support Using Web API in Xamarin

naiknaik USMember ✭✭
edited May 2017 in General

I am looking into creating a cross-platform mobile app in Xamarin that utilizes a SQL server database; specifically an Azure SQL Database. The app needs to send CRUD commands and receive multiple rows back from the SQL server database. The CRUD commands dynamically change depending on the choices of the app user. So I need to send CRUD commands that have variables. I also know that I need to make a web service and not connect to SQL Server directly in mobile apps.

But I am facing problems.

1) The biggest problem I am having is finding any documentation that shows if it's possible to send CRUD commands that include variables to a web service from Xamarin/C# like I mentioned earlier. It's crucial I can do this because my app needs the user to have a lot of control over what gets sent to the sql server database. Sometimes the CRUD command will have WHERE clauses with varying multiple AND's and sometimes it will have no ANDS. I will run into a problem where it will be time-consuming to get every possible combination of ANDS required for the user and keeping up with them if something changes in the schema. Unless there is a workaround I must be able to pass variables and I do not see how to do this currently with Xamarin and Web Services.

2) I don't understand if a web service needs something more than just javascript or whatever it's core language is. For instance, microsoft has a tutorial on creating a web api but it uses ASP.NET. Does that mean the web api needs to be hosted on a Windows server? What about Node.js frameworks that are used to create web apis? Do those need php or some other server side language besides the javascript that they are made in? Or is Xamarin > Javascript on a Web Site > SQL Server all that will be needed?

3) So I guess maybe I should ask: Do you think I should be ok with just having a vast amount of api function calls instead of worrying about having variable support for CRUD commands? I mean I think it would take at the least 254 api function calls with different CRUD commands to get the app working at this point. But the number could easily rise if more schema data is added which is very possible. I just don't think it's a wise choice to go that route.

I have looked at the following resources:

Azure SQL Database: Use Node.js to connect and query data

This explains how to do CRUD commands but there is no explanation how to include variables. This shows javascript code and not xamarin/c#.

How To: Build Xamarin Apps with Node.js REST APIs and SQL Server

This talks about using the Node.js framework LoopBack to query a SQL Server database in Xamarin. But from what I've read and seen in a youtube video, this framework has a web interface where you can input CRUD commands for a specific api call function but it doesn't explain or even mention how you would go about inserting variables from Xamarin into the CRUD commands.

This Node.js framework was mentioned on the Xamarin forums as a recommendation for creating a restful web service with json and SQL Server. The person that recommended it said that he uses it when he wants " real CRUD (not just a mocked service) done fast and easy." But again I see no documentation on how to pass variables from Xamarin into this javascript framework.

Thanks for reading.


  • pearlshwetapearlshweta Member ✭✭

    I am looking for the same thing , but with SQL server. Did you find the solution for it?

Sign In or Register to comment.