MoveNews.asp
资源名称:eat.rar [点击查看]
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:2k
源码类别:
数据库编程
开发平台:
ASP/ASPX
- <%
- '参数f_Object_Table为目标数据库中的表名
- '参数f_Source_ID为采集库的新闻表(FS_News)中的ID集合,ID之间以***分割
- Function NewsToSystem(f_Object_Table,f_Source_ID)
- Dim f_Field_Array,f_Source_Sql,f_Object_Sql,f_Collect_RS,f_System_RS,f_i
- if f_Source_ID = "" then Exit Function
- f_Source_ID = Replace(f_Source_ID,"***",",")
- '第一个参数是采集库中的新闻表(FS_News)中的字段
- '第二个参数是新闻系统中的新闻表的字段
- '第三个字段是表示是否需要进行转换,0表示不需要转换,1表示bool型转换为整形,保留大于1的值
- '对应关系如下:
- '标题
- '作者
- '来源
- '内容
- '添加时间
- '图片新闻
- '是否推荐
- '是否今日头条
- '是否滚动新闻
- '是否并排新闻
- '是否显示评论
- f_Field_Array = Array(_
- Array("Title","",0),_
- Array("Author","",0),_
- Array("Source","",0),_
- Array("Content","",0),_
- Array("AddDate","",0),_
- Array("PicNews","",1),_
- Array("RecTF","",1),_
- Array("TodayNewsTF","",1),_
- Array("MarqueeNews","",1),_
- Array("SBSNews","",1),_
- Array("ReviewTF","",1)_
- )
- f_Source_Sql = "Select * from FS_News where where ID in (" & f_Source_ID & ")"
- f_Object_Sql = "Select * from " & f_Object_Table & " where 1=0"
- Set f_Collect_RS = CollectConn.Execute(f_Source_Sql)
- if Not f_Collect_RS.Eof then
- Set f_System_RS = Server.CreateObject ("ADODB.RecordSet")
- do while Not f_Collect_RS.Eof
- f_System_RS.AddNew
- for f_i=LBound(f_Field_Array) to UBound(f_Field_Array)
- if f_Field_Array(f_i)(2) = 1 then
- if f_Collect_RS(f_Field_Array(f_i)(0)) = True then
- f_System_RS(f_Field_Array(f_i)(1)) = 1
- else
- f_System_RS(f_Field_Array(f_i)(1)) = 0
- end if
- else
- f_System_RS(f_Field_Array(f_i)(1)) = f_Collect_RS(f_Field_Array(f_i)(0))
- end if
- Next
- f_Collect_RS.MoveNext
- Loop
- f_System_RS.Update
- end if
- f_Collect_RS.Close
- Set f_Collect_RS = Nothing
- End Function
- %>