MySQL and .Net

Pieter van der Westhuizen, a professional freelance web & mobile developer and founder of Coalition Software.
Search for a command to run...

Pieter van der Westhuizen, a professional freelance web & mobile developer and founder of Coalition Software.
A recent requirement came up for configurable dynamic forms in a mobile application. There are a few dynamic form packages for Flutter, but I wanted a bit more control over the schema and behavior of the form. Here follows my attempt at creating dyna...

If you've ever written a mobile app with Flutter that integrates with an API, then you'll know that there are a lot of model objects that get passed between the app and the API. JSON Serialization in Flutter can also take a fair amount of boilerplate...

Back in May 2020, Microsoft announced a new feature for Azure Blob Storage called Blob Index. Essentially, this enables you to add key/value tags to your Blob objects and be able to query said Blob objects without having to use a separate service lik...

In my last post, "Using AWS Cognito with Xamarin Forms", I showed how to authenticate with Amazon Cognito using Xamarin Forms and the Xamarin.Essentials Web Authenticator. In this post, we'll go through the process of using the AWS Cognito Hosted UI ...

In this post, I'll show you how to quickly and easily set up user authentication for your Xamarin Forms app using Amazon Cognito. AWS Cognito is a user identity management solution by Amazon. It is a really easy way to add authentication to your appl...

I’m a bit behind with my "5 things I’ve learned" series, and for that I apologize. I’ve been a bit busy at a client site. Will get back to that a.s.a.p.
What I want to chat to you about today is MySQL and how well it works with .Net(so far, it works well, touch wood)…
First, how did I come about using MySQL instead of MS SQL Server? Initially we’ve planned to use SQL Express, but we’ve quickly realized that with the amount of data, that will be moving through the system will probably be more than what SQL Express can handle(4 GB).
Sooo…I figured the client would have to go the full MS SQL Server direction, but working on a contract and already costing the client, I did not want to burden them with any additional cost if it could be avoided.
Enter MySQL.
I’ve always known about it, but never really had a good look at it, all I knew was that it was free, and for the moment that was all that mattered.
There is 2 what you could call editions of MySQL, one is the Enterprise edition and the other the Community edition, the latter is the one that is free. There are 3 downloads with a combined size of about 80MB. After installing that I read the Migrating From Microsoft SQL Server to MySQL pdf document and was delightfully surprised to see that the SQL syntax between MySQL and MS SQL Server is not all that much different. Nothing you could not get used to within a week or so of actively writing some SQL.
Ok, that done, I wanted to start storing and retrieving my data from the MySQL db by using VB.Net. One way is ODBC, but I did not really want to go the ODBC route, considering any performance and ODBC issues that I could possibly encounter. The other, and the option I used, is to use the MySQL Connector for .Net.
It’s a quick download, and you then add it to your project references. You then have access to the following:
MySqlCommand
MySqlConnection
MySqlDataAdapter
MySqlDataReader
and more…
I set forth to write a quick little app that use a datareader to pull data from a table, using normal .Net techniques, and it worked brilliantly. So from a .Net point of view I did not need to learn any new objects, Great!
The tools you get to manage your MySQL is not too shabby, the Query Browser(The MySQL equivalent of Query Analyzer), is not the friendliest app but serves it’s purpose. The MySQL Administrator does a good job at the administrave part, and is easy to use.
All and all an enjoyable experience and I would recommend MySQL to any .Net developer that needs a decent datastore for their application.
Until next time, keep coding!