WFA_psychometric_chart.Form_handler.UpdateLineInfoToDB C# (CSharp) Method

UpdateLineInfoToDB() public method

public UpdateLineInfoToDB ( int id, int prevNodeId, int nextNodeId, Color lineColor, System.Windows.Forms.DataVisualization.Charting.Series lineSeriesVal ) : void
id int
prevNodeId int
nextNodeId int
lineColor Color
lineSeriesVal System.Windows.Forms.DataVisualization.Charting.Series
return void
        public void UpdateLineInfoToDB(int id, int prevNodeId, int nextNodeId, Color lineColor, Series lineSeriesVal)
        {
            string lineSeriesName = lineSeriesVal.Name;
            string tableName = currentLineTableFromDB;

            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 where   id=@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("@id", id);
                command.ExecuteNonQuery();
            }
        }