I had learned how to use MySQL on local machine with C#, but what I can do if I want to use it online? I mean for example, I could connect XML and C# to share data online by putting the xml file on any server. What options are available for MySQL? Is there any way to do something similar?
Usually, you would write a server back end which interacts with the database. This could be a WCF Web Service
if you're using .Net, could be REST Web Services if using Java (.Net actually has REST as well), or a plethora of different things.
Your front end (browser application, etc.) would then interact with this server back end.
Others have mentioned WCF, which is a great option, however MS has just released a beta but stable MVC 4. The MVC 4 update has a web API ability. This enables you to create web services quickly and easily.
Example Code using the Web API:
public class RecordsController : ApiController
{
public HttpResponseMessage Post(Record record)
{
var newId = _Records.Count + 1;
record.ID = newId;
_Records.Add(record);
var newMessage = new HttpResponseMessage<Record>(record);
return newMessage;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.