我要疯了,为什么以前可以的现在不行了!!!!insert 数据无效!!!
gelei 2004-10-17 04:38:46 我要疯了,为什么以前可以的现在不行了!!!!insert 数据无效!!!
因为我在改版起初只是回复帖子不可以,不知道哪里出了毛病现在连发新帖,留言板,货源车源信息统统不可以,但是网上的程序却可以;我把代码从网上下下来不行;我以为是系统的问题重装SQL2000不行,重装WIN2000PRO也不行。
老大们是不是我的不支持INSERT 语句呀?!!!
这是我的站上的处理发新贴的代码,网上可以执行,但是本地机测试写不进数据库,也没有报错!!
改成ADDNEW UPDATE 我试了,也不行。
希望老大们谁知道帮帮忙!!
<!--#include file="../Conn.asp"-->
<%
if Session("LoginSuccess")="" then
response.redirect "../Default.asp"
end if
bbs_typeid=request("bbs_typeid")
bbs_username=session("user")
bbs_pwd=session("bbsuser_pwd")
bbs_title=replace(trim(server.HTMLEncode (Request.Form("bbs_title"))),"'","''")
if bbs_title="" then
Response.Redirect "bbs_say.asp"
end if
bbs_content=replace(trim(server.HTMLEncode (Request.Form("bbs_content"))),"'","''")
'Response.Write bbs_title
'Response.Write bbs_content
'Response.End
Function strlen(str)
Dim i, j, t, c
j = Len(str)
t = j
For i = 1 To j
c = Asc(Mid(str, i, j))
If c < 0 Then c = c + 65536
If c > 255 Then
t = t + 1
End If
Next
strlen = t
End Function
bbs_byte=strlen(bbs_content)
if bbs_byte>1000 then
bbs_byte=bbs_byte/1000 & "k"
elseif bbs_byte>1000000 then
bbs_byte=bbs_byte/1000000 & "m"
end if
bbs_ip=Request.ServerVariables ("remote_addr")
'dsn="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=jy;Data Source=."
'dsn="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=mybole;Data Source=."
set rs=server.CreateObject ("adodb.recordset")
'set conn=server.CreateObject("adodb.connection")
'conn.Open dsn
sql="select max(bbs_bbsid) as maxbbsid from bbs where len(bbs_bbsid)=3"
rs.Open sql,conn,1
if isnull(rs("maxbbsid")) then
maxbbsid="001"
else
maxbbsid=rs("maxbbsid")+1
maxbbsid=right("00" & maxbbsid,3 )
end if
sql="insert into bbs(bbs_bbsid,bbs_username,bbs_title,bbs_content,bbs_ip,bbs_byte,bbs_typeid) values('"& maxbbsid &"','"& bbs_username &"','"& bbs_title &"','"& bbs_content &"','"& bbs_ip &"','" & bbs_byte & "','"& bbs_typeid &"')"
conn.Execute sql
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "bbs_say_ok.htm"
%>
我回复帖子的代码,网上不执行,本地也不执行
<!--#include file="../Conn.asp"-->
<body bgcolor=#F9FEE0>
<%
if Session("LoginSuccess")="" then
response.redirect "../Default.asp"
end if
bbs_typeid=request("bbs_typeid")
bbs_bbsid=request("bbs_bbsid")
lenbbsid=len(bbs_bbsid)+3
bbs_username=session("user")
bbs_pwd=session("bbsuser_pwd")
bbs_title=replace(trim(server.HTMLEncode (Request.Form("bbs_title"))),"'","''")
bbs_content=replace(trim(server.HTMLEncode (Request.Form("bbs_content"))),"'","''")
if bbs_title="" then
Response.Write "请输入主题,<A href='VBScript: window.history.go(-1)'>返回</a>"
Response.End
'Response.Redirect "bbs_show.asp?bbs_bbsid=" & bbs_bbsid & "&bbs_typeid=" & bbs_typeid
end if
Function strlen(str)
Dim i, j, t, c
j = Len(str)
t = j
For i = 1 To j
c = Asc(Mid(str, i, j))
If c < 0 Then c = c + 65536
If c > 255 Then
t = t + 1
End If
Next
strlen = t
End Function
bbs_byte=strlen(bbs_content)
if bbs_byte>1000 then
bbs_byte=bbs_byte/1000 & "k"
elseif bbs_byte>1000000 then
bbs_byte=bbs_byte/1000000 & "m"
end if
bbs_ip=Request.ServerVariables ("remote_addr")
'dsn="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=jy;Data Source=."
'dsn="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=mybole;Data Source=."
set rs=server.CreateObject ("adodb.recordset")
'set conn=server.CreateObject("adodb.connection")
'conn.Open conn
sql="select max(bbs_bbsid) as maxbbsid from bbs where len(bbs_bbsid)='"& lenbbsid &"' and bbs_bbsid like '"& bbs_bbsid &"%'"
rs.Open sql,conn,1
if isnull(rs("maxbbsid")) then
maxbbsid=bbs_bbsid & "001"
else
maxbbsid=rs("maxbbsid")+1
maxbbsid=bbs_bbsid & right(maxbbsid,3 )
end if
sql="insert into bbs(bbs_bbsid,bbs_username,bbs_title,bbs_content,bbs_ip,bbs_byte,bbs_typeid) values('"& maxbbsid &"','"& bbs_username &"','"& bbs_title &"','"& bbs_content &"','"& bbs_ip &"','" & bbs_byte & "',"& bbs_typeid &")"
conn.Execute sql
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Response.Redirect "bbs_say_ok.htm"
%>