WFA_psychometric_chart.Form1_main.UpdateNodeInfoToDB C# (CSharp) Method

UpdateNodeInfoToDB() public method

This information updates the node information
public UpdateNodeInfoToDB ( string id, double xVal, double yVal, string source, string name, string label, Color colorValue, string showItemText, int nodeSizeValue ) : void
id string Nodeid
xVal double x coordinate
yVal double y coordinate
source string source of node
name string name of the node
label string label of node
colorValue Color color value of node
showItemText string which text to show
nodeSizeValue int node size value
return void
        public void UpdateNodeInfoToDB(string id, double xVal, double yVal, string source, string name, string label, Color colorValue, string showItemText, int nodeSizeValue)
        {
            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;";

            using (SQLiteConnection connection = new SQLiteConnection(connString))
            {
                connection.Open();
                string sql_string = "UPDATE " + tableName + "   set  xValue =@xVal ,  yValue=@yVal, source=@source, name=@name, label=@label , colorValue=@colorVal, showTextItem=@text , nodeSize=@node_size_value  where nodeID  =@id";
                SQLiteCommand command = new SQLiteCommand(sql_string, connection);
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@xVal", xVal.ToString());
                command.Parameters.AddWithValue("@yVal", yVal.ToString());
                command.Parameters.AddWithValue("@source", source);
                command.Parameters.AddWithValue("@name", name);
                command.Parameters.AddWithValue("@label", label);
                command.Parameters.AddWithValue("@colorVal", ColorTranslator.ToHtml(colorValue));
                command.Parameters.AddWithValue("@text", showItemText);
                command.Parameters.AddWithValue("@node_size_value", nodeSizeValue);
                command.Parameters.AddWithValue("@id", id);
                //MessageBox.Show("selected value = " + cb_station_names.SelectedItem.ToString());
                command.ExecuteNonQuery();
            }

        }//--close of insertnodeinfotodb fxn
Form1_main