全文预览

北方工业大学数据库实验报告

上传者:梦溪 |  格式:docx  |  页数:15 |  大小:406KB

文档介绍
; //执行Р richTextBox1.Text = " ";Р while (sdr.Read()) //每次读一条记录读完停止Р {Р richTextBox1.Text += sdr.GetString(0) + " " + sdr.GetString(1) + "\n"; //读出的的字符串赋值给控件Р }Р conn.Dispose(); //销毁连接Р }Р private void button6_Click(object sender, EventArgs e)Р {Р string ConStr = "Data Source=911-57;Initial Catalog=scdb;Integrated Security=True"; //连接字符串Р SqlConnection conn = new SqlConnection(ConStr); //建立一个数据库连接实例Р conn.Open(); //打开数据库连接Р mand cmd = new mand(); //用于执行SQL语句Р cmd.Connection = conn;Р mandText = "select o,Grade from Score Score,Student1 where (Student.Sno=Score.Sno) and Score.Grade in (select MAX(Grade) from Score where Score.Sno=Score.Sno group by Sno)";Р mandType = CommandType.Text;Р SqlDataReader sdr = cmd.ExecuteReader(); //执行Р richTextBox1.Text = " ";Р while (sdr.Read()) //每次读一条记录读完停止Р {

收藏

分享

举报
下载此文档