asp对access不能更新操作但能插入
插入的代码:
<%Sub Save_Add()
Dim Info_Title,Id,Merchant_Name,Classid
Info_Title=Trim(Request( "Title "))
Classid=Clng(Trim(Request( "Classid ")))
IF info_title= " " or Isnull(info_title) then
Response.Write( " <script> alert( '请输入IT产品! ');window.history.back(); </script> ")
Response.End
END IF
Set Rs = Server.CreateObject( "Adodb.Recordset ")
Sql= "Select Top 1 * From Machant_Product Where 1=0 "
Rs.Open Sql,Conn,1,3
Rs.AddNew
Rs( "Title ")=Info_Title
Rs( "Parent ")=Classid
Rs( "AddTime ")=Now()
Rs( "UpTime ")=Now()
Rs.Update
Rs.close
End Sub
%>
要修改记录的进行更新操作
代码:
<%
Select Case Request( "Action ")
Case "Save_Mod "
Call Save_Mod()
End Select
Sub Save_Mod()
Dim Info_Title,Classid,brandid,Sql,Rs
BrandID = Trim(Request( "id "))
IF BrandID = " " or Isnull(BrandID)then
Response.Write( " <script> alert( '参数错误! ');window.history.back(); </script> ")
Response.End
END IF
Info_Title=Trim(Request( "Title "))
Classid=Clng(Trim(Request( "Classid ")))
Set Rs = Server.CreateObject( "Adodb.Recordset ")
Sql= "Select Top 1 * From Machant_Product Where Id= "&CLng(BrandID)
Rs.Open Sql,Conn,1,3
If Not(Rs.Bof And Rs.Eof) Then
Rs( "Title ")=Info_Title
Rs( "Parent ")=Classid
Rs( "AddTime ")=Now()
Rs( "UpTime ")=Now()
Rs.Update
end if
Rs.close:Set Rs=Nothing
Response.Redirect "Brand_Manage.asp "
End Sub
%>
BrandID = Trim(Request( "id "))是这样 <input name= "Id " type= "hidden " value= " <%=Rs( "id ")%> "> 传递的
到底是哪里出了差错呢?
------解决方案--------------------Save_Mod '这样调用看看
Sub Save_Mod()
Response.Redirect "Brand_Manage.asp "
End Sub
直接运行上面的看看会不会成功