ASP方面的问题:字符串的语法错误 在查询表达式 'course_name='高等数学' 中。

来源:百度知道 编辑:UC知道 时间:2024/05/28 19:54:00
<!--#include file="conn.asp"-->
<%
if request.form("hidd")<>"" then
course_name=request.form("course_name")
exec="select * from score where course_name='"&course_name
set rs=server.createobject("ADODB.recordset")
rs.open exec,conn,1,1
%>
<table width="760" height="45" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="53"><div align="center"><strong>student_num</strong></div></td>
<td width="115"><div align="center"><strong>student_name</strong></div></td>
<td width="112"><div align="center"><strong>class</strong></div></td>
<td width="47"><div a

你仔细看你的代码:
exec="select * from score where course_name='"&course_name
你的代码中的单引号,没有和他相对应的单引号,应该是这样:
exec="select * from score where course_name='"&course_name&"'"
你试试看,应该可以的。