public void UpdateMixNodeValuesToDB(string NodeID,double xValue,double yValue,int AirFlowValue)
{
//We need to be able to change the air flows as well
// string tableName = "tbl_" + buildingName + "_node_value";//currentNodeTableFromDB;
string tableName = "tbl_" + selectedBuildingList[0].BuildingName + "_node_value";//currentNodeTableFromDB;
string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
string connString = @"Data Source=" + databaseFile + ";Version=3;";
// MessageBox.Show("HERE WE ARE"+ NodeID+"\n xValue = "+ xValue+"\n yval ="+yValue+"\n air flow= "+AirFlowValue);
using (SQLiteConnection connection = new SQLiteConnection(connString))
{
connection.Open();
string sql_string = "UPDATE " + tableName + " set xValue =@xVal , yValue=@yVal, airFlow=@airflow where nodeID =@id";
SQLiteCommand command = new SQLiteCommand(sql_string, connection);
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("@xVal", xValue.ToString());
command.Parameters.AddWithValue("@yVal", yValue.ToString());
command.Parameters.AddWithValue("@airflow", AirFlowValue);
command.Parameters.AddWithValue("@id", NodeID);
command.ExecuteNonQuery();
}
}