WFA_psychometric_chart.Form1_main.CountNumberOfItem C# (CSharp) Method

CountNumberOfItem() public method

This counts the number of items in ...chart_comfrotzone_setting is there any comfortzone item associated with a chart or not
public CountNumberOfItem ( string chartId ) : int
chartId string
return int
        public int CountNumberOfItem(string chartId)
        {

            //default_comfort_zone_of_chart.Clear();//resetting the chart list value..
            string tableName = "tbl_" + selectedBuildingList[0].BuildingName + "_chart_comfort_zone_setting";
            string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
            string connString = @"Data Source=" + databaseFile + ";Version=3;";
            int count = 0;
            using (SQLiteConnection connection = new SQLiteConnection(connString))
            {
                connection.Open();
                string sql = "SELECT COUNT(1) FROM " + tableName + " WHERE chartID='" + chartId + "'";
                //MessageBox.Show("sql : " + sql);
                SQLiteCommand command = new SQLiteCommand(sql, connection);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    count = int.Parse(reader[0].ToString());
                }
            }

            return count;
        }
Form1_main