The query below returns a single VARCHAR value and I want to return this value as a string. How would I do that?
Code snippet:
string query = "SELECT " + FieldName + " FROM " + Table4 + " WHERE StartTime=" +
StartTime + " AND SystemId=" + SystemId + '"';
string result = "";
MySqlCommand cmd = new MySqlCommand(query, connection);
var reader = cmd.ExecuteReader();
while (reader.Read())
{
result = ... // set "result" to the output of the query here
}
return result;
}