WFA_psychometric_chart.Form1_main.UpdateLineInfoToDB C# (CSharp) Method

UpdateLineInfoToDB() public method

This value is edited just now bbk305
public UpdateLineInfoToDB ( string id, string prevNodeId, string nextNodeId, Color lineColor, System.Windows.Forms.DataVisualization.Charting.Series lineSeriesVal, int lineThicknessValue, string line_name, int line_status ) : void
id string
prevNodeId string
nextNodeId string
lineColor Color
lineSeriesVal System.Windows.Forms.DataVisualization.Charting.Series
lineThicknessValue int
line_name string
line_status int
return void
        public void UpdateLineInfoToDB(string id, string prevNodeId, string nextNodeId, Color lineColor, Series lineSeriesVal, int lineThicknessValue,string line_name ,int line_status)
        {
            string lineSeriesName = lineSeriesVal.Name;
            //string tableName = currentLineTableFromDB;
            string tableName = "tbl_" + selectedBuildingList[0].BuildingName + "_line_value";

            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 " + tableName + " set prevNodeId=@pn,nextNodeId=@nn,lineColorValue=@lc,lineSeriesId=@ls ,thickness = @linethickness ,name = @lnName,status = @lnStatus where   lineID=@id ";
                SQLiteCommand command = new SQLiteCommand(sql_string, connection);
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@pn", prevNodeId);
                command.Parameters.AddWithValue("@nn", nextNodeId);
                command.Parameters.AddWithValue("@lc", ColorTranslator.ToHtml(lineColor));
                command.Parameters.AddWithValue("@ls", lineSeriesName);
                command.Parameters.AddWithValue("@linethickness", lineThicknessValue);
                command.Parameters.AddWithValue("@id", id);
                command.Parameters.AddWithValue("@lnName", line_name);
                command.Parameters.AddWithValue("@lnStatus", line_status);
                command.ExecuteNonQuery();
            }
       }
Form1_main