告诉我错哪里了,这段程序try { string ID = this.textBox1.Text; string birthday = this.textBox3.Text; string Name = this.textBox2.Text; string Email = this.textBox4.Text; string QQ = this.textBox5.Text; System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.Cfile://\\student.mdb">\\student.mdb"; conn.Open(); string strSQL = "SELECT 学号,姓名,性别,出生日期,籍贯,是否团员,电子邮箱,QQ号码" + "FROM 基本信息表" + "WHERE 学号 ='" + ID + "'"; OleDbCommand Cmd = conn.CreateCommand(); Cmd.CommandText = strSQL; OleDbDataReader reader = Cmd.ExecuteReader(); reader.Read(); this.listView1.Items.Add(reader["学号"].ToString()); this.listView1.Items[1].SubItems.Add(reader["姓名"].ToString()); this.listView1.Items[2].SubItems.Add(reader["性别"].ToString()); this.listView1.Items[3].SubItems.Add(reader["出生日期"].ToString()); this.listView1.Items[4].SubItems.Add(reader["籍贯"].ToString()); this.listView1.Items[5].SubItems.Add(reader["是否团员"].ToString()); this.listView1.Items[6].SubItems.Add(reader["电子邮箱"].ToString()); this.listView1.Items[7].SubItems.Add(reader["QQ号码"].ToString()); reader.Close(); conn.Close(); } catch (Exception ex) { MessageBox.Show("错误" + ex.ToString(), "错误"); }
[[i] 本帖最后由 匿名 于 2007-7-4 17:07 编辑 [/i]] |