日期:2014-05-20  浏览次数:20873 次

根据学号和日期查询(程序补完整)
如题:以下是我做得,后面的不知道怎么赋值?



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ShineSoft.CountryInsure.InsureBPLOra;
using ShineSoft.CountryInsure.InsureEntityOra;


namespace WindowsApplication2
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {

  }
  private System.Data.DataTable QQ;
  private void eulute()
  {
  QQ = new DataTable("STUDENT");
  QQ.Columns.Add(new DataColumn("ID"));
  QQ.Columns.Add(new DataColumn("NAME"));
  QQ.Columns.Add(new DataColumn("CHINESE"));
  QQ.Columns.Add(new DataColumn("MATH"));
  QQ.Columns.Add(new DataColumn("ENGLISH"));
  QQ.Columns.Add(new DataColumn("POLITY"));
  QQ.Columns.Add(new DataColumn("PCLASS"));
  QQ.Columns.Add(new DataColumn("TIME"));
  }

  private void button1_Click(object sender, EventArgs e)
  {
  this.Search(this.textBox1.SelectionLength,this.dateTimePicker1.Value.ToString(),this.dateTimePicker2.Value.AddDays(1).ToString());
  }

  private void button2_Click(object sender, EventArgs e)
  {
  Application.Exit();
  }
  private void Search(int ID, string dateTimePicker1, string dateTimePicker2)
  {
  this.listView1.Items.Clear();
  string SQL = "select *form STUDENT where ID='" + textBox1 + "'and TIME BETWEEN'" + dateTimePicker1 + "'AND'" + dateTimePicker2 + "'";
   
  string ww = "";

  if (Convert.ToInt32(textBox1.Text) <= 11 && Convert.ToInt32(textBox1.Text) >= 1)
  {
  ww = "where ID='" + textBox1 + "'and TIME BETWEEN'" + dateTimePicker1 + "'AND'" + dateTimePicker2 + "'";
  }
  else
  {
  MessageBox.Show("您的输入有误!!!");
  this.DialogResult = DialogResult.Cancel;
  return;
  }
  ww = "where TIME BETWEEN'" + dateTimePicker1 + "'AND'" + dateTimePicker2 + "'";
  SQL = SQL + ww;
  System.Data.DataTable a = new ManageReport().GetReportData(SQL);
  for (int i = 0; i < this.listView1.Items.Count; i++)
  {
  DataRow OO = this.QQ.NewRow();
  OO["NAME"] = this.listView1.Items[i].SubItems[1].Text;
  OO["CHINESE"] = this.listView1.Items[i].SubItems[2].Text;
  OO["MATH"] = this.listView1.Items[i].SubItems[3].Text;
  OO["ENGLISH"] = this.listView1.Items[i].SubItems[4].Text;
  OO["POLITY"] = this.listView1.Items[i].SubItems[5].Text;
  OO["PCLASS"] = this.listView1.Items[i].SubItems[6].Text;
  QQ.Rows.Add(OO);
  }
  }
  }
}