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

 

 ·关于一个非常简单线程问题    »显示摘要«
    摘要: class mythread extends thread { public static void main(string [] args) {    mythread t=new mythread(); t.start();    system.out.println("one."); t.start(); system.out.println("tw......
    摘要: 上传图片和rm用fileinputstream好,还是filereader好写?? ......


关于TreeView控件的使用

如何用TreeView控件显示Access数据库中年月日的内容。  
  如:  
  1999  
      |__一月  
      |     |__1日  
      |     |__2日  
      |           ………  
      |__二月  
            |__1日  
            |__2日

NO.1   作者: online

最好是数据库中有三个字段分别保存年月日  
  Public   Sub   AddNodes()  
  Dim   strkey   As   String  
  Dim   mNodes   As   MSComctlLib.Nodes  
  Dim   mNode1   As   MSComctlLib.Node  
  Dim   mNode2   As   MSComctlLib.Node  
   
  Dim   I   As   Long  
   
  On   Error   Resume   Next  
   
  Set   mNodes   =   tvwMain.Nodes  
  Dim   rs1   As   ADODB.Recordset  
  Set   rs1   =   New   ADODB.Recordset  
  With   rs1  
                  Set   .ActiveConnection   =   conn  
                  .CursorLocation   =   adUseClient  
                  .Source   =   "select   id,mc   from   lb   order   by   ID"  
                  .LockType   =   adLockReadOnly  
                  .CursorType   =   adOpenForwardOnly  
                  .Open  
  End   With  
   
  mNodes.Clear  
  With   rs1  
                  If   .EOF   And   .BOF   Then  
                                                  Set   rs1   =   Nothing  
                                                  Exit   Sub  
                  End   If  
                  For   r   =   1   To   .RecordCount  
                                    strkey   =   "o"   &   .Fields("ID")  
                                    Set   mNode1   =   mNodes.Add(,   ,   strkey,   .Fields("mc")   &   "",   7,   7)  
                                    第二层循环  
                                    Dim   rs   As   ADODB.Recordset  
                                    Set   rs   =   New   ADODB.Recordset  
                                     
                                    strsql   =   "select   *   from   ws   where   mid="   &   .Fields("id")  
                                    rs.Open   strsql,   conn,   adOpenStatic,   adLockPessimistic  
                                    For   j   =   1   To   rs.RecordCount  
                                    Key   =   "t"   &   rs.Fields("id")  
                                    Set   mNode2   =   mNodes.Add(mNode1.Index,   tvwChild,   Key,   rs.Fields("mc"),   7,   7)  
                                    rs.MoveNext  
                                    Next  
                                  .MoveNext  
                          Next  
                  .Close  
  End   With  
   
  Set   rstNodes   =   Nothing  
  On   Error   GoTo   0  
  End   Sub

NO.2   作者: rainstormmaster

不分也可以,但你要自定义一个函数分别取出年、月、日。再结合楼上的应该就可以了。

NO.3   作者: ljc_zy

 
  数据库中   字段             日期

Option   Explicit  
   
  Private   Sub   Command1_Click()  
          Dim   i   As   Long  
          Dim   j   As   Long  
          Dim   n   As   Long  
           
          For   i   =   1998   To   2002  
                  DoEvents  
                  For   j   =   1   To   12  
                          For   n   =   1   To   31  
                                  If   IsDate(Str(i)   &   "-"   &   Str(j)   &   "-"   &   Str(n))   Then  
                                          Debug.Print   Str(i)   &   "年"  
                                          Debug.Print   Str(j)   &   "月"  
                                          Debug.Print   Str(n)   &   "日"  
                                          Debug.Print   "================="  
                                  End   If  
                          Next  
                  Next  
          Next  
           
  End   Sub  
   
 


 ·大家帮我出个主意    »显示摘要«
    摘要: 我做了一个显示动画的小程序。 动画保存为什么格式的文件好呢? ?gif ?avi 如何比较简单的实现? ......
» 本期热门文章:
· 热门栏目:
» 相关精选文章
» 其它相关:

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