I am building a windows 8 app which requires me to get data from a remotely hosted server. Which API can I use to get the required data? I am using c# and xaml. I basically want to communicate with Microsoft SQL Server Analysis Services. ADOMD.NET cannot be used as windows 8 store apps donot support it.
In a Windows 8 app, we can specify for example a connection string to read out data stored in a server-side database. Not only would this be a huge security risk (imagine your connection string being on the thousands of devices where your app is downloaded!), it would also be pretty useless to have it there. WinRT has no knowledge of talking with a (remote) database. This means no ADO.NET or LINQ-To-SQL classes are in the API.
windows 8 style apps dont have out of the box functionality to contact to a database. so you need webservices to conect at a remote database.
If you have a database on a web server for which you can write an OData service, then that's an option. You can use the OData Libraries
I hope http://blogs.msdn.com/b/phaniraj/archive/2012/04/26/developing-windows-8-metro-style-applications-that-consume-odata.aspx will help you.
Related
Im am trying to connect a local mysql database which runs on xampp with a Universal Windows Platform (UWP) Application. I couldn't find any examples or tutorials on how to archieve this. In one article i have read that this isn't even possible and only sqlite is supported. Is this true?
I have to do a work for school and one criteria is, that it must have a relational database and another is to support multi-user functionality.
I dont know if it is not possible or am I just to blind to find Informations? Sometimes it seems really hard to get to informations to windows app development.
Did someone make experiences with connecting relational databases to UWP-Apps?
UWP app can connect to any server based database behind a web service. Per my experience, Windows Store app can directly connect to MySQL. Check this. I didn't have a chance to try it on win 10 UWP.
Sqlite is the database if you want to deploy a database to the device along with your UWP app.
Well, I am not very good with c#.net thus I am really confused about the database that I should use. I am trying to build a windows phone app that can communicate with the SQL database that I have online. I have asked some people and they have suggested me to write an API for the database so that I can generate a JSON/XML data from it and use it in my windows phone app and other way around.
So, here are some of my questions:
1) Which Database should I use for my .net website so that my windows phone app can communicate with the database as well?
2) If I have a Database then should I make an API for it, so that I can help it send JSON data to the mobile app and receive it as well or is there any better option for this?
I couldn't find a proper answer for these questions anywhere. do let me know the best options available.
Thanks in advance!
The choice of database is completely yours and depends on the type of application you want. You must never access your database on the server from an application directly. Make necessary APIs to do that for you for security reasons.
Having said that, you can look at MongoDB if you are going to work with extensive JSON since it can store, retrieve and process JSON out of the box.
Other than that, any database can be used to serialize data to JSON and send it to your app. Like for example you can use MySQL, and the database adapters will help you return the results to your app in a JSON format.
You can use any database that suites your requirements of website, it will not effect your windows phone app because windows phone will communicate with API's(Web API is the best way) so for windows phone app it is transparent.
Yes, Create Web APIs at server side and call those APIs from mobile to send/receive data in JSON format this the standard and best way to send/receive data.
I would also suggest to store your server side data in windows phone local store(using SQLite or in json files). So that if mobile is not connected to internet your app can still work in offline mode and sync data when internet connection is available.
P:S. As you are developing new windows phone application than target windows phone 8.1(windows Runtime or Universal app) instead windows pone 8 as there are new features and improvements in it. and soon all windows phone 8 devices will upgraded to windows phone 8.1
I've found a few Google searches on this topic but nothing that really helps me.
Maybe because I don't understand what's happening.
How do I connect my Localdb using WA to a windows store application and how do i get the data from it with C#. Like "SELECT * FROM Table"
There is no direct way, you need to create a separate app that provides WCF endpoint that process all requests to the database and returns data to the client in this case this windows store app. You can create a windows service that provides such endpoint and in that service you implement all communication with database and provide API to the WSA(windows store app) through WCF
I have a question regarding C# Windows Forms connecting to external hosted databases.
I have a GoDaddy SQLServer 2008 database that I use for my web development database purposes. I am creating a C# windows form and I need that to connect to the database. I know how to connect a C# Windows Form to a local database, so I figured that the only difference would be to use a different connection string.
The connection string I am using is as follows:
Data Source=limeoatsdb.db.8996219.hostedresource.com; Initial Catalog=database; User ID=userid; Password=password;
I replaced the values above with dummy values, but obviously in my code they have the correct values.
First of all, is it even possible to connect a C# windows form to a GoDaddy database?
Secondly, if it is possible, any ideas on what I am doing wrong?
This is not possible. GoDaddy blocks all connections to its databases from systems it doesn't manage.
This is typical of many hosting companies. It's common that you can only use their databases from their own systems, for security reasons.
If you need access to your data, you'd need to create some form of intermediary step, such as building an API in your website which could be accessed by your form.
Beyond GoDaddy blocking ports, I should point out this is a bad idea if you plan on distributing the app.
If you allow clients to connect directly to your database, you're essentially leaving the front door wide open. There'd be nothing stopping me from connecting to your DB server with SQL Management Studio and fiddling with your data.
Think of it this way: in a web app, you'd never give client-side JavaScript direct access to your database. Instead, it has to go through your app server.
I'd create some kind of server that provides an API that the client Win Form can call. The server can even be a regular web server that provides REST/SOAP/whatever APIs. A good place to start might be looking in to WCF.
Yes, you can connect to a SQL Server database on GoDaddy servers.
It's a feature I've used to access the database through SQL Server Management Studio.
Check this: https://stackoverflow.com/questions/357147/go-daddy-sql-server-2005-remote-connection
Basically, when creating your database, make sure you check the "Direct Access" option.
Obviously, this is a security issue you must be aware of.
I have atleast 5 billion ideas for a new App in Windows 8. However, most of them rely on a remote database connection.
Which is currently not possible in Metro apps. But I don't want just a work-around. Or an script that accesses an API which will access the DB and return results. So then I went to the MS forums and found a post somewhere (which I can't seem to find now) stating that I can just use Windows Azure SQL database and can connect to that one from within Windows Metro.
But I don't see any resources or documentation to back that up and I'm completely lost as to what to do.
Most apps these days, to offer any sort of personalized user experience need to communicate with the outside world and it's just impossible to do in Metro apps from what I can see.
Does anybody know if you can connect to a Windows Azure SQL DB from within a Metro style app? Any resources/Docs/Links/Samples you know of?
Thank you!
Metro apps are optimized for tablets and generally CPU-and-battery constrained devices. Directly connecting to a database and processing the results is expensive in CPU, battery AND bandwidth terms.
What's more, database protocols aren't cachable and were not meant to deal with internet latencies. Your app could waste a lot of time trying and retrying to connect to the database each time the connection quality degraded.
The best option would be to a set of WCF Data Services on top of your database and expose them to your application. It's easy to create a WCF Data Service on top of an Entity Framework model and the OData protocol used by WCF Data Services allows querying your entities using LINQ in an asynchronous manner. More complex processing can be done in the web server.
At this point Metro does not have a System.Data so there is no direct connect to the database. You would need to communicate with the database via WCF to a Web Service.
Metro does have a user settings facility but I cannot find it right now. http://msdn.microsoft.com/library/windows/apps/BR208189
The history is that the jumping off point for Metro was Silverlight. Not saying that makes sense just what I have read. It appears Microsoft wants to sandbox Metro for the Metro Store.