public void UpdateNewDataFromDGV(string name, string chartID)
{
if(name == "")
{
//If name is empty the do not update
return;
}
//string newTableNodeName = "tbl_" + name + "_node";
//string newTableLineName = "tbl_" + name + "_line";
string buildingNameValue = selectedBuildingList[0].BuildingName;
string tableNameOfChart = "tbl_" + buildingNameValue + "_chart_detail";
string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
string connString = @"Data Source=" + databaseFile + ";Version=3;";
using (SQLiteConnection connection = new SQLiteConnection(connString))
{
connection.Open();
//SQLiteDataReader reader = null;
string sql_string = "update " + tableNameOfChart + " set chartName=@chartName_value where chartID = @chartID_value;";
SQLiteCommand command = new SQLiteCommand(sql_string, connection);
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("@chartName_value", name);
command.Parameters.AddWithValue("@chartID_value", chartID);
// command.Parameters.AddWithValue("@line_table_value", newTableLineName);
// command.Parameters.AddWithValue("@id_provided", id);
//MessageBox.Show("selected value = " + cb_station_names.SelectedItem.ToString());
command.ExecuteNonQuery();
}
}