日期:2014-05-17  浏览次数:21012 次

数据读取问题
<!--#include   file= "top.asp "-->
<%
dim   conn
dim   connstr
dim   db
db= "database/sjrx.asp "
Set   conn   =   Server.CreateObject( "ADODB.Connection ")
connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   &   Server.MapPath( " "&db& " ")
conn.Open   connstr
id=request( "id ")
code=request( "code ")
SQL= "Select   *   from   news   where   id= ' "&id& " '   and   code= ' "&code& " ' "
Set   ss=Server.CreateObject( "Adodb.Recordset ")
ss.Open   sql,   Conn,1,3       '第   14   行
title=ss( "title ")
content=( "content ")
addtime=( "addtime ")
%>
出现问题:标准表达式中数据类型不匹配。
/meiti/skin/rencai/news.asp,   第   14   行

------解决方案--------------------
SQL= "Select * from news where id= ' "&id& " ' and code= ' "&code& " ' "
改为
SQL= "Select * from news where code= ' "&code& " ' and id= "&id
------解决方案--------------------
用樓上的試下吧,感覺你的沒錯.至少在SQLSERVER裏可用.
------解决方案--------------------
access中如果id是数字型的话就不能加 '
------解决方案--------------------
SQL= "Select * from [news] where [id]= "&id& " and [code]= ' "&code& " ' "