Set conn=Server.CreateObject("ADODB.Connection")
conn.open"PROVIDER=SQLOLEDB;DATASOURCE=srv1;UID=sa;PWD=;DATABASE=pubs"
Set rs=Server.CreateObject("ADODB.Recordset")
sSql="select * from table1 order by id desc"
rs.open sSql,conn,2,2
if not rs.eof then
iMaxid=Clng(rs("id"))+1
strlen=4-len(cstr(iMaxid))
strMaxid=string(strlen,"0") & cstr(iMaxid)
else
strMaxid="0001"
end if
rs.addnew
rs("id")=strMaxid
rs("title")=strTitle
rs("sort")=strSort
rs("img").AppendChunk Fields("file").Value
rs("content")=quoteChg(strContent)
rs("todate")=date()
rs.update
rs.close
response.write "<script language='javascript'>alert('添加记录成功')</script>"
end if
end if