当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 请问在数据库中(excel或access)怎样才能自动把两个字段中内容重复的记录删除(或是把未重复的提出)?例如:网站数据库data.mdb的shop表中有2千条记录,其中要对比所有记录的a字段与所有记录的b字段的内容(也就是说对比记录1的字段a与2千条记录的字段b内容是否相同,然后对比记录2的字段a与2千条记录的字段b内容是否相同...一直到最后一条记录),如果a和b内容相同则删除此记录......
    摘要: <%@ page contenttype="text/html;charset=gb2312"%> <%@ page import ="java.io.*"%> <html> <%! class filejsp implements filenamefilter { string str=null; file......


日期

我輸入任意年月  
  如何取得此月第一周星期一的日期

NO.1   作者: lei414

知道年份,月份,和月份的第几个星期,求相应的星期是从几号到几号  
  function   finddate(ayear,amonth,aweek)  
  strdate   =   CDate(ayear   &   "-"   &   amonth   &   "-1")  
  if   amonth=12   then  
  strdate1   =   CDate(ayear+1   &   "-"   &   "1"   &   "-1")  
  else  
  strdate1   =   CDate(ayear   &   "-"   &   amonth+1   &   "-1")  
  end   if  
  weekstr   =   Weekday(strdate)  
  if   weekstr=1   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   6  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+7  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=2   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   5  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+6  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=3   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   4  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+5  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=4   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   3  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+4  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=5   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   2  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+3  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=6   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart   +   1  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+2  
  weekend   =   weekstart   +   6  
  if   weekend>=strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
  if   weekstr=7   then  
  if   aweek=1   then  
  weekstart   =   strdate   +   CInt((aweek   -   1)   *   7)  
  weekend   =   weekstart  
  else  
  weekstart   =   strdate   +   CInt((aweek   -   2)   *   7)+1  
  weekend   =   weekstart   +   6  
  if   weekend>=   strdate1   then  
  weekend=   strdate1-1  
  end   if  
  end   if  
  end   if  
   
  finddate=weekstart&"~"&weekend  
  end   function

NO.2   作者: yehanyu

DateTime   dtInput   =   DateTime.Parse(Year.Text+"-"+Month.Text+"-1");  
  DateTime   dtF   =   dtInput;  
  if(dtF.DayOfWeek!=DayOfWeek.Monday)  
  {  
              for(int   i=1;i<=7;i++)  
              {  
                    dtF=dtF.AddDays(1);  
                    if(dtF.DayOfWeek==DayOfWeek.Monday)  
                    {  
                          break;  
                    }  
              }  
  }  
  Response.Write("此月第一周星期一是:"+dtF.ToString());  
   
   
  不一定是最优化的,仅提供参考:)


    摘要: 我想学oracle可不知道怎么入手,各们仁兄可不可以教教学习方法? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE