sql语句的问题string mysql = "SELECT Cname,Grade FROM student,score,course WHERE student.Sno = score.Sno" + " and score.Cno = course.Cno and student.Sno =" + Convert.ToString(textBox1.Text) + " and score.Text =" + Convert.ToInt32(comboBox1.Text); --换行后 and 的前面应该是空格
" and score.Cno = course.Cno and student.Sno =" + Convert.ToString(textBox1.Text) +
" and score.Text =" + Convert.ToInt32(comboBox1.Text);
--换行后 and 的前面应该是空格
"and score.Cno = course.Cno and student.Sno =" + Convert.ToString(textBox1.Text)
这里 你不妨断定看一看 你整句的sql 是不是在这里 student.sno= 后面的其实是个字符换 但是 在数据库里 应该是'字符串' 这样的格式 你应该是报语法错误的问题
http://social.msdn.microsoft.com/Search/zh-CN?query=sqlParameter&ac=2
[code=sql]