示例#1
0
文件: Form1.cs 项目: Hetzendorfer/SEW
        public Form1()
        {
            InitializeComponent();
            config.DBConnection dBConnection = config.DBConnection.Instance();
            dBConnection.Username     = "******";
            dBConnection.Password     = "";
            dBConnection.DatabaseName = "rechnung";

            FillListBox();
        }
示例#2
0
文件: Form1.cs 项目: Hetzendorfer/SEW
 private void FillListBox()
 {
     config.DBConnection dBConnection = config.DBConnection.Instance();
     if (dBConnection.IsConnect())
     {
         string query = "SELECT rechnung.ID FROM rechnung;";
         try
         {
             var cmd    = new MySqlCommand(query, dBConnection.Connection);
             var reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 this.listBox1.Items.Add(reader.GetInt32(0));
             }
             dBConnection.Close();
         }
         catch (Exception e)
         {
         }
     }
 }