以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 调用查询表时报错没有某一列 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=172094) |
-- 作者:Tough -- 发布时间:2021/9/23 10:45:00 -- 调用查询表时报错没有某一列 \'获取大膜生产计划单列表数据 Dim lstFilter As String = args(0) \'列表条件 If lstFilter = "" Then lstFilter = "isnull(bPrint,0) = 0 and isnull(bComplete,0) = 0" Else lstFilter = "isnull(bPrint,0) = 0 and isnull(bComplete,0) = 0 and " & lstFilter End If \'抽取数据(库存匹配) Dim jb As new SQLJoinTableBuilder("大膜生产计划单列表","V_sc_BigFilmMake_List") jb.ConnectionName = "DB" jb.AddCols("_Identify","iID","cCode","dDate","cMachineCode","cTeamCode","cType","cInvCode","cInvName","iThick","iWidth","iLength","cNo","iMakeOrder","bComplete","bPrintOrder","iCompleteQuantity","dDownLineDate","dDownLineDateTime","cBarcode","iWeight","bPrint","cVerifier","dMakeDate","formulaCode","technologyCode") \'jb.AddCols("配方名称","工艺序号") jb.Filter = lstFilter jb.Build() DataTables("大膜生产计划单列表").DataCols.Add("配方名称",Gettype(String),50) DataTables("大膜生产计划单列表").DataCols.Add("工艺序号",Gettype(String),50) MessageBox.Show(1) For Each dc As DataCol In DataTables("大膜生产计划单列表").DataCols Try If dc.Name.Contains("配方名称") Or dc.Name.Contains("工艺序号") Then Continue For End If If dc.Name.Contains("technologyCode") Or dc.Name.Contains("formulaCode") Then Continue For End If If dc.Name.Contains("bPrintOrder") Then dc.Caption = "是否打印配方工艺" Continue For End If dc.Caption = DataTables("sc_BigFilmMakeJoin").DataCols(dc.Name).Caption Catch ex As Exception Continue For MessageBox.Show(ex.Message) End Try Next MessageBox.Show(2) 有时候调用这个函数的时候,会报错说没有“配方名称”的列,有时候有不报错,而且我添加 MessageBox.Show(1)来调试,发现报错之前并没有调用的这个 MessageBox.Show(1)的窗口,这是为什么呢,求各位大神帮帮忙啊 |
-- 作者:有点蓝 -- 发布时间:2021/9/23 10:51:00 -- 哪一个MessageBox.Show可以弹出来? \'获取大膜生产计划单列表数据 Dim lstFilter As String = args(0) \'列表条件 MessageBox.Show(lstFilter) If lstFilter = "" Then lstFilter = "isnull(bPrint,0) = 0 and isnull(bComplete,0) = 0" Else lstFilter = "isnull(bPrint,0) = 0 and isnull(bComplete,0) = 0 and " & lstFilter End If MessageBox.Show(0) \'抽取数据(库存匹配) Dim jb As new SQLJoinTableBuilder("大膜生产计划单列表","V_sc_BigFilmMake_List") jb.ConnectionName = "DB" jb.AddCols("_Identify","iID","cCode","dDate","cMachineCode","cTeamCode","cType","cInvCode","cInvName","iThick","iWidth","iLength","cNo","iMakeOrder","bComplete","bPrintOrder","iCompleteQuantity","dDownLineDate","dDownLineDateTime","cBarcode","iWeight","bPrint","cVerifier","dMakeDate","formulaCode","technologyCode") \'jb.AddCols("配方名称","工艺序号") jb.Filter = lstFilter jb.Build() MessageBox.Show(1)
DataTables("大膜生产计划单列表").DataCols.Add("配方名称",Gettype(String),50) DataTables("大膜生产计划单列表").DataCols.Add("工艺序号",Gettype(String),50) MessageBox.Show(2) |
-- 作者:Tough -- 发布时间:2021/9/23 10:59:00 -- MessageBox.Show(0)可以弹出来,然后就报错了 |
-- 作者:有点蓝 -- 发布时间:2021/9/23 11:06:00 -- 报什么错? 这句代码是注释的还是启用的?\'jb.AddCols("配方名称","工艺序号") V_sc_BigFilmMake_List是一个查询表?使用了什么SQL语句?
|
-- 作者:Tough -- 发布时间:2021/9/23 11:33:00 -- 回复:(有点蓝)报什么错?这句代码是注释的还是启用... V_sc_BigFilmMake_List是一个SQL server中的视图,’jb.add那句是注释的,我直接通过查询方法从视图中查询数据,然后又添加了两个临时列,然后查询的时候就会报错 |
-- 作者:有点蓝 -- 发布时间:2021/9/23 11:48:00 -- MessageBox.Show(lstFilter)弹出什么内容?注意"配方名称"是添加的临时列,不存在数据库的,查询条件不能使用这个列名 |
-- 作者:Tough -- 发布时间:2021/9/23 12:03:00 -- 回复:(有点蓝)MessageBox.Show(lstFilter)弹出什么... 这个是筛选条件,如果报错点击继续的话就会继续往下运行弹出MessageBox.show(1)
|
-- 作者:有点蓝 -- 发布时间:2021/9/23 12:04:00 -- 关闭退出项目,删除项目所在的文件夹里的bin目录,然后重启项目试试。 |
-- 作者:Tough -- 发布时间:2021/9/23 15:13:00 -- 删除项目的bin文件刚开始没有问题,但是过一会就会又出现报错现象 |
-- 作者:有点蓝 -- 发布时间:2021/9/23 15:16:00 -- 检查什么地方添加了不合适的条件!或者上传实例给我们测试。 注意不要把项目文件放到云盘目录(比如onedrive)里使用
|