void chaXun(string tiaojian) { SqlConnection conn = new SqlConnection(login.sqlName); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = chaXunStr(tiaojian); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { //bufferTable = dt.Copy(); table查询结果 = dt.Copy(); maxID = (int)table查询结果.Rows[table查询结果.Rows.Count - 1]["id"]; minID = (int)table查询结果.Rows[0]["id"]; dataGridView1.DataSource = table查询结果; Thread t = new Thread(delegate() { 加载题目(dt); }); t.Start(); 题目加载 nf = new 题目加载(); nf.ShowDialog(); showQuestion(0); chaxunIndex = 0; } else MessageBox.Show("没有符合条件的题目"); }
private void dataGridView4_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { tabControl4.SelectedTab = tabPage15; SqlConnection conn = new SqlConnection(login.sqlName); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "new_教师知识_查绑定表_按知识"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("zhishiID", SqlDbType.Int).Value = dataGridView4.Rows[this.dataGridView4.CurrentRow.Index].Cells["考点号"].Value.ToString(); dt_知识绑题目 = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); // Console.Write(dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells[5].Value.ToString()); da.Fill(dt_知识绑题目); da.Dispose(); dataGridView2.DataSource = dt_知识绑题目; Thread t = new Thread(delegate() { 加载题目(dt_知识绑题目); }); t.Start(); 题目加载 nf = new 题目加载(); nf.ShowDialog(); 显示题目(0, dt_知识绑题目); index_知识绑题目 = 0; }
private void 查看绑定ToolStripMenuItem_Click(object sender, EventArgs e) { if (treeView1.SelectedNode != null) { if (treeView1.SelectedNode.Level == 1) { tabControl4.SelectedTab = tabPage15; SqlConnection conn = new SqlConnection(login.sqlName); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "new_教师知识_查绑定表_按知识"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("zhishiID", SqlDbType.Int).Value = treeView1.SelectedNode.Tag; //cmd.Parameters.Add("teacherID", SqlDbType.Int).Value = treeView1.SelectedNode.Tag; dt_知识绑题目 = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt_知识绑题目); da.Dispose(); dataGridView2.DataSource = dt_知识绑题目; bufferTable = dt_知识绑题目.Copy(); Thread t = new Thread(delegate() { 加载题目(dt_知识绑题目); }); t.Start(); 题目加载 nf = new 题目加载(); nf.ShowDialog(); 显示题目(0, dt_知识绑题目); index_知识绑题目 = 0; } } }