using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form10 : Form
    {
        public Form10()
        {
            InitializeComponent();
        }
        DataBase mydatabase = new DataBase();
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            int i=mydatabase.ExecuteSQL("insert into student(sno,sname,class) values("+textBox1.Text.Trim()+",'"+ textBox2.Text.Trim() +"','"+ textBox3.Text.Trim() +"')");
            if (i > 1)
            {
                MessageBox.Show("成功插入","信息");
            }
        }

        private void fillcombox()
        {
            ArrayList al = mydatabase.GetListArray("select sno from student", 0);
            foreach (int sno in al)
            {
                comboBox1.Items.Add(sno.ToString());
            }
            this.comboBox1.SelectedIndex = 0;
        }
        
        private void Form10_Load(object sender, EventArgs e)
        {
            fillcombox();

        }
    }
}