含有参数变量的sql语句,如何用C#语句表示。
stringmysql="SELECTCname,GradeFROMstudent,score,courseWHEREstudent.Sno=score.Sno"+"an...
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 score.Cno = course.Cno and student.Sno =" + Convert.ToString(textBox1.Text) +
"and score.Text =" + Convert.ToInt32(comboBox1.Text);
程序在运行时没有结果出来,能帮我改改吗? 展开
2个回答
展开全部
string mysql = string.Format("SELECT Cname,Grade FROM student,score,course WHERE student.Sno = score.Sno and score.Cno = course.Cno and student.Sno = '{0}' and score.Text = {1}",textbox1.Text,ComboBox1.Text);
追问
谢谢,出现结果了。
2013-11-29
展开全部
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)“’;”;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询