<% 	Dim ModeID,TableName,ModeName,Rs,id
	 ModeID = skweboa.Return_to_numerical(Request("ModeID"))
	 ID = skweboa.Return_to_numerical(Request("ID"))
	 if ModeID=0 or ModeID="" Then ModeID=1
	 if id=0 or id="" Then id=1
 	set rs=skweboa.SK_axe("select * from ModeForm_skweb where ModeID="&ModeID)
	if  rs.eof then  response.write "错误":response.end
	TableName=rs("ModeTable")
	ModeName=rs("ModeName")

 %> 
<%
 	action = Request("A")
	Select Case action
			Case "D"
				Call Del()
			case "edit"
				call edit()
 			Case "save"
	            Call save()	
			Case Else
				Call Main()
	End Select
	
	Sub del()
	
	  dID = Request("ID") 
	  IF dID = "" Then
	Call skweboa.SK_window("请指定要删除的内容","","1","1")
			End IF
	    If instr(dID,",")>0 then
			dID=replace(dID," ","")
		   Conn.Execute ("Delete from "&TableName&" Where ID in (" & dID & ")")		
		Else
			Conn.Execute ("Delete from "&TableName&" Where ID=" & skweboa.Return_to_numerical(dID)&" ")
		End if
		Set conn=nothing
 	    response.Redirect("" & Request.ServerVariables("HTTP_REFERER") & "")
 		Response.End
		
 	End Sub 

 sub save()

	DIM Rs,SH,HH
		SQL = "Select * From "&TableName&" Where ID="&request("id")
		SH=Request.Form("SH")	
		Set Rs=Server.CreateObject("Adodb.RecordSet")
		Rs.Open SQL,Conn,1,3
		Rs("SH")= SH
		Rs("HH")= Request.Form("HH")
 		Rs.update
		Rs.Close:Set Rs=Nothing
 
		Call skweboa.SK_window("操作成功",""&MyDbPath&"SKCMS/dialog.asp?action=closmain","","")
 		Response.End		
    end sub
		

sub edit()
 	dim rs,MX_Arr,i,k,rs1,rs2,mx
	set rs2=skweboa.SK_axe("SELECT * FROM Table_skweb Where skweboa=3 and  ModeID=" & ModeID & " order by OrderID desc,ID asc ")
    If  rs2.eof Then  Call skweboa.SK_window("没有添加字段","","3","3")
	do while not rs2.eof
		mx=mx&rs2("FieldName")&","
 	rs2.movenext
	loop
	 mx=Left(mx, Len(mx) - 1)
  	set rs=skweboa.SK_axe("select "&mx&" ,* from "&TableName&" where id="&id&" order by id desc")
     If  rs.eof Then  Call skweboa.SK_window("没有相关数据","","3","3")
	 %>