private void Form1_Load(object sender, EventArgs e)
        {
            教师联系方式 fom = new 教师联系方式();

            fom.Show();
            SqlConnection conn = new SqlConnection(strconnecting);
            string        sql1 = string.Format("select * from 工学院 where id ='{0}'", tid);

            conn.Open();
            SqlCommand    comm1 = new SqlCommand(sql1, conn);
            SqlDataReader read  = comm1.ExecuteReader();

            if (read.Read())
            {
                label7.Text = (string)read["name"];
                conn.Close();
                conn.Open();
                string         sql2  = string.Format("select name from course where tid = '{0}'", tid);
                SqlCommand     comm2 = new SqlCommand(sql2, conn);
                SqlDataAdapter da1   = new SqlDataAdapter();//新建新的da以及ds表
                DataSet        ds1   = new DataSet("paike");
                da1.SelectCommand = comm2;
                SqlCommandBuilder builder = new SqlCommandBuilder(da1);
                da1.Fill(ds1, "course");
                cou1 = (string)ds1.Tables["course"].Rows[0][0];
                cou2 = (string)ds1.Tables["course"].Rows[1][0];
                comboBox3.Items.Add(cou1);
                comboBox3.Items.Add(cou2);
            }
            else
            {
                MessageBox.Show("读取失败", "重试", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void 本学院教师联系方式ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            教师联系方式 fom = new 教师联系方式();

            fom.Show();
        }