Foxtable(狐表)用户栏目专家坐堂 → [求助]狐狸老爹,表已上传


  共有12679人关注过本帖树形打印复制链接

主题:[求助]狐狸老爹,表已上传

帅哥哟,离线,有人找我吗?
紙上不談兵
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:113 积分:731 威望:0 精华:1 注册:2011/8/16 14:13:00
  发帖心情 Post By:2011/9/5 14:58:00 [显示全部帖子]

余下的作练习题,自己练练手吧


窗口中的Table控件


DataSource属性

Table有一个DataSource属性,可以通过此属性动态设置其绑定的表。

例如:

Tables("窗口1_Table1").DataSource = DataTables("订单")


 回到顶部
帅哥哟,离线,有人找我吗?
紙上不談兵
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:113 积分:731 威望:0 精华:1 注册:2011/8/16 14:13:00
  发帖心情 Post By:2011/9/5 15:46:00 [显示全部帖子]

俺昨晚将下列If ...End 中间两条倒转来,结果死活死活的,不干活!累俺纳闷了半天.
If dr1(s2) =True Then
        dr(format(CDate(s1),"M月_d日")) =Left(s2,1)
         Exit For
End If


 回到顶部
帅哥哟,离线,有人找我吗?
紙上不談兵
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:113 积分:731 威望:0 精华:1 注册:2011/8/16 14:13:00
  发帖心情 Post By:2011/9/5 16:14:00 [显示全部帖子]

在窗口中插入一个SQL型Table:

Dim b As New SQLGroupTableBuilder("统计表","考勤表")
b.Groups.AddDef("日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("班组")
b.Groups.AddDef("班序")
b.Groups.AddDef("姓名")
b.Totals.AddDef("白班")

Dim t As Table = Tables(e.form.name & "_Table1")
t.DataSource=b.BuildDataSource()
t.StopRedraw
t.Cols.Remove("白班")

Dim s,s1,s2,Ls As String
Ls = DataTables("考勤表").GetComboListString("日期","姓名 is not null","日期")
Dim Ts As String()={"白班","二班","三班","公休","事假","婚假","病假","丧假","旷工"}


With t.DataTable.DataCols
    For Each s1 In Ls.split("|")
        If .Contains(format(CDate(s1),"M月_d日"))=False Then
            .Add(format(CDate(s1),"M月_d日"),Gettype(String),3)
        End If
    Next
End With

Dim dr,dr1 As DataRow
For Each dr  In t.DataTable.DataRows
    s = "班组= '" & dr("班组") & "'and 班序= '" & dr("班序") & "'and 姓名= '" & dr("姓名")
    For Each s1 In Ls.split("|")
        dr1= DataTables("考勤表").Find(s & " 'and 日期 = #" & CDate(s1) & "#")
        If dr1 IsNot Nothing Then
            For Each s2 In Ts
                If dr1(s2) =True Then
                    dr(format(CDate(s1),"M月_d日")) =Left(s2,1)
                    Exit For
                End If
            Next
        End If
    Next
Next
t.AutoSizeCols(10)
t.ResumeRedraw

 回到顶部