请问一个关于ASP,SQL,ACCESS 之间的问题

merryhyde 2004-05-05 09:56:57
我有一个产品发布系统,我是用ASP+SQL做的。。系统运行正常。由于我租用的空间不支持SQL 所以现在我要把SQL换成ACCESS 现在我已经把SQL转化为ACCESS了。。可是系统不能用了,。。有但是有一部分还是可以用的。。这之间应该有哪些语法上的区别或是要做怎么样的修改。。

部分代码如下:<%@language="VBscript"%>
<%Response.Expires=0%>
<!--#include file="../include/checkuser.asp"-->
<!--#include file="../include/db_conn.asp"-->
<%
sort_action=Request.Form("sort_action")
boardname=replace(Request.Form("boardname"),"'","''") '取得新目录名
current_ver=Request.QueryString("version")

if sort_action="add_new" then '当添加时

'当添加二级分类时
set rs=conn.execute("select typename from t_product_type where typename='" & boardname & "' and mever='" & current_ver &"' ")
if rs.eof then
conn.execute("insert into t_product_type(typename,mever) values('" & boardname & "','" & current_ver & "')")
Response.Redirect "product_catalog.asp?version=" & current_ver
else
showError chr(34) & boardname & chr(34) & "目录已经存在!"
end if

elseif sort_action="edit" then '当修改时

type_id=Request.Form("type_id")
level_name=Request.Form("level_name")

if level_name="root" then
sqlstr="select catalogname from t_product_catalog where catalogname='" & boardname & "' and mever='" & current_ver & "'"
sqlstr1="UPDATE t_product_catalog SET catalogname='" & boardname & "' where catalogID=" & type_id

elseif level_name="child" then
sqlstr="select typename from t_product_type where typename='" & boardname & "' and mever='" & current_ver & "'"
sqlstr1="UPDATE t_product_type SET typename='" & boardname & "' where ID=" & type_id

else
Response.Redirect "product_catalog.asp?version=" & current_ver
end if

set rs=conn.execute(sqlstr)
if rs.eof then
conn.execute sqlstr1
Response.Redirect "product_catalog.asp?version=" & current_ver
else
showError chr(34) & boardname & chr(34) & "目录已经存在!"
end if

elseif sort_action="del" then '当删除时

type_id=Request.Form("id")
conn.execute "DELETE FROM t_product_type WHERE ID=" & type_id

Response.Redirect "product_catalog.asp?version=" & current_ver

end if
%>
<%sub showError(msg)%>
<script language="javascript">
alert('<%=msg%>');
location.href="product_catalog.asp?version=<%=current_ver%>";
</script>
<%end sub%>


这部代码开始运行正常,换了ACCESS 数据库之后只有前边的添加部不行。。。

谢谢急。。。
...全文
137 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
myschevon 2004-05-06
  • 打赏
  • 举报
回复
sql和access的不同主要出现在数据库的连接方式和某些sql语句上的不同,这是因为sql和access里的数据类型不同而造成。
merryhyde 2004-05-05
  • 打赏
  • 举报
回复
ID字段是自增的。。。我这个以前上SQL+ ASP 运行正常。现在我用SQL导出数据的方法把SQL换ACCESS 。还是以前的代码。。可是就是运行不正常了。。 要怎么样的解决呢??
outwindows 2004-05-05
  • 打赏
  • 举报
回复
看了一下,看不出什么问题,你的ID字段是自增的吗?

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧