ǝǝʞǝǝʞ
ǝǝʞǝǝʞ
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
!close
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Looks like on dispose it will close it for you
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Depends on what IDisposable does for a MySqlConnection
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
If you just want to fire and forget then it will probably crash the app with an UnobservedTaskException if SaveData throws any exceptions and you don't prevent them from bubbling up.
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Why would you not want to await?
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Then further up the call stack you have to await SaveData()
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Change the return type to Task<int> if you want the affected row counts back
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
Not awaiting the connect.ExecuteAsync(sql, parameters) will just let it keep going and close the connection.
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
public Task SaveData<T>(string sql, T parameters, string connectionString)
public Task SaveData<T>(string sql, T parameters, string connectionString)
to
public async Task SaveData<T>(string sql, T parameters, string connectionString)
public async Task SaveData<T>(string sql, T parameters, string connectionString)
var value = connect.ExecuteAsync(sql, parameters);
var value = connect.ExecuteAsync(sql, parameters);
to
var value = await connect.ExecuteAsync(sql, parameters);
var value = await connect.ExecuteAsync(sql, parameters);
22 replies
CC#
Created by Wasted on 11/15/2024 in #help
✅ Random error only when app is run on same server as database
What is the type of the rows variable? Also not awaiting the ExecuteAsync
22 replies