In my function app I have an IF statement that launches a main part of code only if two variables are set to 1 and 0. These variables are flags stored in the Azure SQL Table. I have made a simple select query, however the variable values are always -1. How can I solve this problem? Here is my code:
conn.Open();
int IsDatamartSynced, IsCubeProcessed;
var select_for_IsDatamartSynced = "SELECT TOP (1) IsDatamartSynced FROM dbo.test";
var select_for_IsCubeProcessed = "SELECT TOP (1) IsCubeProcessed FROM dbo.test";
/*var text = "UPDATE SalesLT.SalesOrderHeader " +
"SET [Status] = 5 WHERE ShipDate < GetDate();";*/
using (SqlCommand cmd = new SqlCommand(select_for_IsDatamartSynced, conn))
{
IsDatamartSynced = cmd.ExecuteNonQuery();
log.Info($"in using {IsDatamartSynced}");
}
using (SqlCommand cmd = new SqlCommand(select_for_IsCubeProcessed, conn))
{
IsCubeProcessed = cmd.ExecuteNonQuery();
log.Info($"in using {IsCubeProcessed}");
}