I am trying to insert some data into my MySql database and have successfully made a connection and submitted data, however my variables are saving as the actual name of the variable and not the value I am trying to assign. I am collecting the logged in user of my asp system using identity and am collecting a score of a user from some radio button lists on my main page.
What I try to save the score with the id for a user with id of 12345 for example and a score of 4. it will save the word Id and the word score instead of the numbers.
Here is my current code:
if (score != 0) ;
{
string Id = User.Identity.GetUserId();
string MyConString = "SERVER=localhost;" +
"DATABASE=synther_physics;" +
"UID=root;" +
"PASSWORD=rootpass;";
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "INSERT INTO userscores (Id, momentsandenergytestscore) VALUES ('Id','score');";
connection.Open();
Reader = command.ExecuteReader();
connection.Close();
}