WFA_psychometric_chart.Form_handler.InsertLineInfoToDB C# (CSharp) Метод

InsertLineInfoToDB() публичный Метод

public InsertLineInfoToDB ( 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
Результат void
        public void InsertLineInfoToDB(int id,int prevNodeId,int nextNodeId,Color lineColor,Series lineSeriesVal)
        {
            //--Note for series the series.name property will be stored in databse and later it will be converted.
            string lineSeriesName = lineSeriesVal.Name;
            string tableNamex = currentLineTableFromDB;

              //  MessageBox.Show("Table name for line =" + tableNamex);

            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 = "insert into " + tableNamex + "(id,prevNodeId,nextNodeId,lineColorValue,lineSeriesId) VALUES(@id,@pn,@nn,@lc,@ls)";
                SQLiteCommand command = new SQLiteCommand(sql_string, connection);
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@id", id);
                command.Parameters.AddWithValue("@pn", prevNodeId);
                command.Parameters.AddWithValue("@nn", nextNodeId);
                command.Parameters.AddWithValue("@lc", ColorTranslator.ToHtml(lineColor));
                command.Parameters.AddWithValue("@ls", lineSeriesName);

                command.ExecuteNonQuery();
            }
        }