sean sean - 1 year ago 74
MySQL Question

The Keyword Used is Not Supported (MySQL and Visual Studio 2010)

I am creating a login form using C# and MySQL. I got stuck in SQLConnection. It says that the keyword I used is not supported.

This is my code:

using (var con = new SqlConnection("host=localhost;usr=root;password=admin;db=timekeeping;"))
using (var cmd = con.CreateCommand())
cmd.CommandText = "SELECT count(*) FROM receptionist WHERE username = @username AND password = @password;";
cmd.Parameters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@password", password);
var count = (long)cmd.ExecuteScalar();
return count > 0;

This is the screenshot of the error message:

enter image description here

Answer Source

You need to use the correct connection string keywords for MySQL:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download