以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- 动态生成菜单项目 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=161025) |
||||
-- 作者:良才 -- 发布时间:2021/3/3 9:49:00 -- 动态生成菜单项目 点击"午餐信息"下拉菜单项目代码?请老师指教,谢谢! ItemClick 代码 Dim t As Table= e.Form.Controls("Table1").Table Dim SQl As String Select Case e.StripItem.Name Case e.StripItem.Text 点击"基本信息"下拉菜单项目 SQL = "Se lect 学期,班级,b.学生编号,IIF(Len(学生姓名) = 2,Mid(学生姓名,1,1) & \' \' & Mid(学生姓名,2,1),学生姓名) As 学生姓名,身份证号,IIF(Len(身份证号) =18,IIF(MID(身份证号,17,1) Mod 2,\'男\',\'女\'),Null) As 性别,IIF(Len(身份证号) =18,MID(身份证号,7,4) & \'-\' & MID(身份证号,11,2) & \'-\' & MID(身份证号,13,2)) As 出生日期,int(datediff(\'d\',IIF(Len(身份证号) =18,MID(身份证号,7,4) & \'-\' & MID(身份证号,11,2) & \'-\' & MID(身份证号,13,2)),Cdate(cstr(year(Date()))+\'-09-01\'))/365.2422) As 年龄,民族 Fr om {学生基本信息} a Inner JOIN {学生缴费} b ON b.[学生编号] = a.[学生编号] Where 学期 = \'"& e.StripItem.Text &"\'" 点击"午餐信息"下拉菜单项目 SQL = "Se lect 学期,班级,b.学生编号,IIF(Len(学生姓名) = 2,Mid(学生姓名,1,1) & \' \' & Mid(学生姓名,2,1),学生姓名) As 学生姓名,餐费金额 Fr om {学生基本信息} a Inner JOIN {学生缴费} b ON b.[学生编号] = a.[学生编号] Where 学期 = \'"& e.StripItem.Text &"\'" End Select t.Fill(SQL,True)
[此贴子已经被作者于2021/3/3 9:49:52编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/3/3 10:03:00 --
|
||||
-- 作者:良才 -- 发布时间:2021/3/3 10:14:00 -- 谢谢 |
||||
-- 作者:良才 -- 发布时间:2021/3/5 10:25:00 -- 老师再请教,生成学期和车次,如图 cmd.C cmd.CommandText = "Sel ect top 2 a.学期,车辆号牌 & \'(\'& 车次 & \')\' As 车次 From {学生缴费} a Inner JOIN {接送安排} b ON a.[学期] =b.[学期] And a.[接送地点] = b.[接送地点] Group by a.学期,车辆号牌 & \'(\'& 车次 & \')\' Order by a.学期 Desc" dt = cmd.ExecuteReader If e.Form.Strips.Contains("学生接送") Then e.Form.Strips("学生接送").Items.Clear() \'清除原来的项目 For Each bj As String In dt.GetValues("学期|车次","","学期 Desc") e.Form.Strips("学生接送").Items.Add(bj,bj, "", StripItemTypeEnum.MenuItem) Next End If e.Sender.ShowContextStrip(0, e.Sender.Height, e.Form.Strips("学生接送"))
|
||||
-- 作者:有点蓝 -- 发布时间:2021/3/5 10:34:00 -- 什么问题,没看懂 |
||||
-- 作者:良才 -- 发布时间:2021/3/5 15:44:00 -- 学生接送下层是学期,学期下层是车次 |
||||
-- 作者:有点蓝 -- 发布时间:2021/3/5 15:57:00 -- If e.Form.Strips.Contains("学生接送") Then e.Form.Strips("学生接送").Items.Clear() \'清除原来的项目 dim s as dtring = "" dim item as WinForm.StripItem For Each bj() As String In dt.GetValues("学期|车次","","学期 Desc") if s <> bj(0) item = e.Form.Strips("学生接送").Items.Add(bj(0),bj(0), "", StripItemTypeEnum.MenuItem) end if s = bj(0) item.Items.Add(bj(1),bj(1),"", StripItemTypeEnum.MenuItem) Next End If
|
||||
-- 作者:良才 -- 发布时间:2021/3/5 16:03:00 -- 老师出错 ![]() ![]() |
||||
-- 作者:有点蓝 -- 发布时间:2021/3/5 16:07:00 -- 笔误,但是也不会连这种基础的错误都判断不了吧 dim s as string = ""
|
||||
-- 作者:良才 -- 发布时间:2021/3/6 10:39:00 -- 老师,出错
[此贴子已经被作者于2021/3/7 14:00:32编辑过]
|