<%
Act = Request.QueryString("act")
If act = "save" Then
Set Rs = Server.CreateObject("ADODB.RecordSet")
isedit = False
id = Request.Form("id")
If id<>"" And IsNumeric(id) Then isedit = True
productId=Request.Form("productId")
num=Request.Form("num")
price=Request.Form("price")
If isedit Then
Rs.Open "Select * From country Where id="& id,Conn,1,3
Rs("addtime")=now()
Rs.Update:Rs.Close:Set Rs=Nothing
productId=split(productId,",")
numarr=split(num,",")
pricearr=split(price,",")
Conn.execute("delete from price where AreaId="&id&"")
For i=0 to ubound(productId)
If numarr(i)="" then numarr(i)=0
If pricearr(i)="" then pricearr(i)=0
Conn.execute("insert into price (productId,AreaId,num,price) values("&productId(i)&","&id&","&numarr(i)&",'"&pricearr(i)&"')")
Next
Conn.Close:Set Conn=Nothing
Page = Request.QueryString("Page")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
Ord=Server.UrlEnCode(Request.QueryString("Ord"))
Response.Redirect "?keys="&Keys&"&Ord="&Ord&"&Page="&Page
Else
Rs.Open "country",Conn,1,3
Rs.AddNew
Rs("addtime")=now()
Rs.Update:Rs.Close
productId=split(productId,",")
numarr=split(num,",")
pricearr=split(price,",")
For i=0 to ubound(productId)
If numarr(i)="" then numarr(i)=0
If pricearr(i)="" then pricearr(i)=0
Conn.execute("insert into price (productId,AreaId,num,price) values("&productId(i)&","&id&","&numarr(i)&",'"&pricearr(i)&"')")
Next
Set Rs=Nothing:Conn.Close:Set Conn=Nothing
Response.Redirect "?"
End If
Conn.Close:Set Conn=Nothing
Response.End
End If 'end save
If Act = "add" Or Act = "edit" Then
id = Request.QueryString("id")
isedit = False
If id<>"" And IsNumeric(id) Then isedit=True
If isedit Then
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From country Where id="&id,Conn,1,1
If Not Rs.Bof And Not Rs.Eof Then
countryCode=TextUnCode(Rs("countryCode"))
countryName=TextUnCode(Rs("countryName"))
addtime=Rs("addtime")
Else
isedit = False
End If
Rs.Close:Set Rs=Nothing
End If
Page = Request.QueryString("Page")
Keys=Server.UrlEnCode(Request.QueryString("Keys"))
Ord=Server.UrlEnCode(Request.QueryString("Ord"))
hrefstr = "?keys="&Keys&"&Ord="&Ord&"&Page="&Page
%>
<%
Response.End
End If 'End add
If Act="postchk" Then
Keys = Server.UrlEnCode(Request.QueryString("Keys"))
Ord = Server.UrlEnCode(Request.QueryString("Ord"))
Page = Request.QueryString("Page")
chkact = Request.Form("chkact")
SqlStr = ""
For i = 1 To Request.Form("chkbox").Count
If SqlStr<>"" Then
SqlStr = SqlStr & " Or id="&Request.Form("chkbox")(i)
Else
SqlStr = " Where id="&Request.Form("chkbox")(i)
End If
Next
SqlStr = "Delete From country"&SqlStr
Conn.Execute(SqlStr):Conn.Close:Set Conn=Nothing
Response.Redirect "?Keys="&Keys&"&Ord="&Ord&"&Page="&Page
Response.End
End If 'End postchk
Keys=Request.QueryString("Keys")
Keyscode=TextEnCode(Keys)
Ord=Request.QueryString("Ord")
Page = Request.QueryString("Page")
If Ord<>"" Then
OrdStr=Ord&","
Else
OrdStr=""
End If
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From country Where countryName like '%"&Keyscode&"%' or countryCode like '%"&Keyscode&"%' Order By id Desc",Conn,1,1
Keys=Server.UrlEnCode(Keys)
Ord=Server.UrlEnCode(Ord)
hrefstr = "?keys="&Keys
%>