• 大小: 48KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-10-01
  • 语言: C#
  • 标签: 聚类算法  mysql  

资源简介

使用mysql 进行数据库连接,把分析聚类的结果再存储到 mysql数据库中,代码实现了连接数据库, 分析数据,把结果返回数据库的相关内容。有注释。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using MySql.Data.MySqlClient;


namespace ClusterAnalysis
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary org_data=new Dictionary();
            org_data = getData();                                                    //获取数据             第一步
           
            #region //测试
            //测试
            /* Dictionary data_analy_temp_cu_A_m=new Dictionary(); 
             Dictionary data_org_f_A_m=new Dictionary();
            string[] a={“a“};
            int[] b={01};
            data_analy_temp_cu_A_m.Add(ab);
            float[] c={51020};
             data_org_f_A_m.Add(“cc“c);
            float[] d={52040};
             data_org_f_A_m.Add(“css“d);
             calculate_Avg_min(data_analy_temp_cu_A_m data_org_f_A_m 0);*/
            /* float[] a = { 1 10 50 };
             float[] b = { 2 10 50 };
             float[] c = { 0.1f 30 100};
             float[] d = { 0.2f 31 101 };
             float[] e = { 55 0.1f 1010 };
             float[] f = { 54 0.2f 1011 };
           
             org_dataqq.Add(“a“ a);
             org_dataqq.Add(“b“ b);
             org_dataqq.Add(“c“ c);
             org_dataqq.Add(“d“ d);
             org_dataqq.Add(“e“ e);
             org_dataqq.Add(“f“ f);*/
            //测试
            /* foreach (var item in analy_after)
             {
                 Console.WriteLine(“**“);
                 Console.WriteLine(item.Key);
                 Console.WriteLine(“**“);
                 foreach (var items in item.Value)
                 {
                     Console.WriteLine(items);
                 }
                 Console.WriteLine(“***********“);
             }*/
            #endregion
          
            
            Dictionary analy_after = new Dictionary();

            while (true)
            {
                Console.WriteLine(“输入簇的个数“);
                string num = Console.ReadLine();
                analy_after = analysisData(org_datanum);                             //分析数据            第二步
               
                del_Table();                                         //删除原来已经聚好的聚类。******
                
                add_Analy_After(org_data analy_after);                               //结果数据库添加               第三步  

            }


           
        }



        #region  //删除原来已经聚好的聚类。******
        public static void del_Table()       //删除聚类好的表格 *******(1)
        {
            MySqlConnection mysql = getMySqlCon();
            String sqlDel = “delete from  julei“;   
            MySqlCommand mySqlCommand = getSqlCommand(sqlDel mysql);
            mysql.Ope

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-25 08:39  ClusterAnalysis\
     文件         189  2017-05-25 08:39  ClusterAnalysis\App.config
     目录           0  2017-05-25 08:39  ClusterAnalysis\bin\
     目录           0  2017-05-25 09:00  ClusterAnalysis\bin\Debug\
     文件       10240  2017-06-09 12:45  ClusterAnalysis\bin\Debug\ClusterAnalysis.exe
     文件         189  2017-05-25 08:39  ClusterAnalysis\bin\Debug\ClusterAnalysis.exe.config
     文件       26112  2017-06-09 12:45  ClusterAnalysis\bin\Debug\ClusterAnalysis.pdb
     文件       22984  2017-06-09 15:27  ClusterAnalysis\bin\Debug\ClusterAnalysis.vshost.exe
     文件         189  2017-05-25 08:39  ClusterAnalysis\bin\Debug\ClusterAnalysis.vshost.exe.config
     文件         490  2016-07-16 19:44  ClusterAnalysis\bin\Debug\ClusterAnalysis.vshost.exe.manifest
     文件        2886  2017-05-25 09:00  ClusterAnalysis\ClusterAnalysis.csproj
     目录           0  2017-05-25 08:39  ClusterAnalysis\obj\
     目录           0  2017-06-09 12:45  ClusterAnalysis\obj\Debug\
     文件         472  2017-06-09 15:55  ClusterAnalysis\obj\Debug\ClusterAnalysis.csproj.FileListAbsolute.txt
     文件       11336  2017-05-25 09:00  ClusterAnalysis\obj\Debug\ClusterAnalysis.csprojResolveAssemblyReference.cache
     文件       10240  2017-06-09 12:45  ClusterAnalysis\obj\Debug\ClusterAnalysis.exe
     文件       26112  2017-06-09 12:45  ClusterAnalysis\obj\Debug\ClusterAnalysis.pdb
     文件        6685  2017-05-25 08:50  ClusterAnalysis\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件           0  2017-05-25 08:39  ClusterAnalysis\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2017-05-25 08:39  ClusterAnalysis\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2017-05-25 08:39  ClusterAnalysis\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     目录           0  2017-05-25 08:39  ClusterAnalysis\obj\Debug\TempPE\
     文件       18959  2017-06-09 12:45  ClusterAnalysis\Program.cs
     目录           0  2017-05-25 08:39  ClusterAnalysis\Properties\
     文件        1350  2017-05-25 08:39  ClusterAnalysis\Properties\AssemblyInfo.cs

评论

共有 条评论