ASP高手进!!!!!

来源:百度知道 编辑:UC知道 时间:2024/04/27 21:14:13
错误类型:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
在关键字 'index' 附近有语法错误。
/inc.asp, 第 6 行

附:inc.asp
<!--#include file="conn.asp"-->
<%
dim rs1,sql1
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from index where id=1"
rs1.open sql1,conn,1
%>
<%sub top%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><%=rs1("homepage")%></title>

ASP+SQL Server数据库


sql1="select * from index where id=1"

改为
sql1="select * from [index] where id=1"

这样就可以了!

将rs打开加一个数字,为:rs1.open sql1, conn, 1, 3

同意楼上的,同时检查一下你的index表id的数据类型,如果是字符的sql1="select * from index where id='1'"

index是保留字,不能做表名!改个名称比如index1就好了。

晕,用了关键字了
sql1="select * from [index] where id=1"