The online racing simulator
Geting Data Errors from a MySQL Server in C#
Well, I have made my InSim app connect to my MySQL server and get data, I don't know why but if I run a predefined query for example

static public int GetRacesWon(string Username)
{
return int.Parse(MySQL.RunReturnQuery("SELECT `RacesWon` FROM `highscores` WHERE (Name='nock44')"));
}

it will return how many races "nock44" has won but if I do:

static public int GetRacesWon(string Username)
{
return int.Parse(MySQL.RunReturnQuery("SELECT `RacesWon` FROM `highscores` WHERE (Name='"+Username+"')"));
}

I get an error on:
string Retn = SQLCmd.ExecuteScalar().ToString();

The Error:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."

Never mind, I just remembered that the first connection is "host" which dosen't have a username so its searching for " Name='' "

FGED GREDG RDFGDR GSFDG