'C# MariaDB Update Function working in DataStore but not updating in .NET Application
My initial issue is that my database does not update when I call on this specific code. I am not sure if it is C# itself or the update query that I am calling.
string _connectionString = "validConnectionstring";
using (MySqlConnection _mySqlConnection = new MySqlConnection(_connectionString)
{
_mySqlConnection.Open();
using (MySqlCommand command = new MySqlCommand("UpdateProfileStatus", _mySqlConnection))
{
command.Transaction = _mySqlConnection.BeginTransaction();
command.CommandTimeout = TimeSpan.FromSeconds(60).Seconds;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@_username", "test");
command.Parameters.AddWithValue("@_status", true);
command.ExecuteNonQuery();
}
_mySqlConnection.Close();
}
I get no updates in my database but my console logs that the query is executed returning the value of 1 but there is no update that actually happens in my DB. Is there something in my code to reason why it is failing?
Here is the stored procedure that I have for the update command
CREATE PROCEDURE UpdateProfileStatus(_username VARCHAR(25), _status BOOL)
UPDATE Profile SET status = _status WHERE username = _username;
I know the Stored Procedure works but am not sure why my .NET application is not responding to my procedure call. Is it something to do with my implementation of the parameters or is it my procedure itself?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
