以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]临时列的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=47796) |
-- 作者:mosquito1003 -- 发布时间:2014/3/17 21:17:00 -- [求助]临时列的问题 大虾们,我用SQL查询得一个表,如下的代码 Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "Select * From {MA14_MRP_Detail} where ([SNo] Not IN(Select [MRPSNo] From {PU02_Order_Detail})) And ([BillNo] In(Select [BillNo] From {MA14_MRP} where [State] = 2)) And [Qty] > 0 And [PurchaseOrProduce] = \'采购\'" dt = cmd.ExecuteReader Tables("SQLTest_Table1").DataSource = dt 然后是 DataTables("SQLTest_Table1").DataCols.Add("备注",Gettype(String)) \'窗口名是 SQLTest 增加这个临时列,然后我再这个临时列输入数据,就会老是提示说该窗口表不存在此“备注”列! 请问为什么?很简单的一个问题,琢磨一晚上了,还是弄不懂?请大虾们指点下。
|
-- 作者:mosquito1003 -- 发布时间:2014/3/17 21:18:00 -- 纠正下第三行是cmd.C 是正确的,可以查询到表的!
|
-- 作者:逛逛 -- 发布时间:2014/3/17 21:22:00 -- Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "Select * From {MA14_MRP_Detail} where ([SNo] Not IN(Select [MRPSNo] From {PU02_Order_Detail})) And ([BillNo] In(Select [BillNo] From {MA14_MRP} where [State] = 2)) And [Qty] > 0 And [PurchaseOrProduce] = \'采购\'"
dt = cmd.ExecuteReader
dt.DataCols.Add("备注",Gettype(String)) \'窗口名是 SQLTest
Tables("SQLTest_Table1").DataSource = dt 然后是
|
-- 作者:mosquito1003 -- 发布时间:2014/3/17 21:39:00 -- 十分的谢谢了!终于弄明白了! |