AspMVC基本操作

来自站长百科
跳转至: 导航、​ 搜索

导航: 上一页

AspMVC基本操作


  首先在Contorl/DemoCotorl.asp 添加代码
   管理员操作 表:admins  操作:Save,Del,List,Model
     '保存及修改/返回Bool
    Public Function Saveadmins(Req)
    Saveadmins = Contorl.SaveModel(Req,"admins") 
    End Function
    '删除
     Public Function Deladmins(ID)
     Deladmins = Contorl.DelModel(ID,"admins")
     End Function
    '列表/数组中
     Public Function Listadmins()
     Listadmins = Contorl.ListModel("admins","")
     End Function
    '实体/Key
     Public Function Modeladmins(ID)
     Set Modeladmins = Contorl.GetModel(ID,"admins")
      End Function



 1.添加操作 
  表单:
 <form action="save.asp" method="post">
 <input id = "username" name="username" type="text"/>
 </form>
  Asp代码:
    Set Demo= new DemoControl
 Demo.saveadmins(Request)
 2.查询操作
   多个对像查询
     Set Demo = new DemoControl
     AdminArr = Demo.Listadmins()
     Set Admin = AdminArr(0)
    单个对像查询
     Set Admin = Demo.Modeladmins(AdminID)
  3.修改操作
    表单:
 <form action="save.asp" method="post">
 <input id = "id" name="id" type="text"/>
 <input id = "username" name="username" type="text"/>
 </form>
  Asp代码:
    Set Demo= new DemoControl
 Demo.saveadmins(Request)
  4.删除操作
    Set Demo= new DemoControl
 Demo.Deladmins(AdminID)