asp查询数据库(数据转换出错)?

来源:百度知道 编辑:UC知道 时间:2024/06/30 21:43:06
请问到底要怎样转换数据类型,比如说,我有个音乐数据库,我要查询id=8 这条数据的 歌名:

以下是查询语句:

<%
strsql="select * from music where id=8"
%>
<%while not conn.eof%>
<%=conn("mingcheng")%>
<%conn.movenext
wend%>
<%
conn.close
set conn=nothing
%>

打开时,提示

ADODB.Connection 错误 '800a0bb9'

参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。

前面加上你的数据库连接代码
<%
set rs=server.createobject("adodb.recordset")
strsql="select * from music where id=8"
rs.open strsql,conn,1,1
do while not rs.eof
<%=rs("mingcheng")%>
<%rs.movenext
LOOP
rs.close
set rs=nothing
%>