以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- sql语句错误提示 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=38427)
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 13:42:00
-- sql语句错误提示
以下的语句不知为何会出错?
Dim s As String = e.Form.Controls("TextBox2").Text Dim t As WinForm.Table = e.Form.Controls("Table1") If s = "" Then s = "" Else s = s & "%" \'tbl.Filter = "item_no Like" & txt End If t.Table.Fill("select DISTINCT {obas_part1}.part_no,{obas_part}.item_no As 料品编码,{obas_part_spec}.cu_part_no As 客户编码,type_name As 料品类别,part_name As 料品名称,part_spec As 料品规格,base_name As 单位,{obas_part_spec}.wf_cp_ggrem As 规格备注,wf_cp_gz As 国家,wf_cp_kr As 客人,wf_bz_fs As 包装方式 From ((({obas_part1} Inner JOIN {obas_part} ON {obas_part1}.part_no = {obas_part }.part_no) Inner JOIN {obas_part_type} ON {obas_part1}.part_type = {obas_part_type}.type_no ) Inner JOIN {obas_base_code} ON {obas_base_code}.base_code = {obas_part1}.unit_no) left JOIN {obas_part_spec} on {obas_part1}.part_no= {obas_part_spec}.part_no where {obas_base_code}.code_type =\'115\' and {obas_part1}.part_type Like \'1%\' and {obas_part_spec}.cu_part_no Like \'" & s & "\'or {obas_base_code}.code_type =\'115\' and {obas_part1}.part_type Like \'1%\' and {obas_part.item_no} like \'" & s & "\' Order By {obas_part}.item_no","erp",True)
t.Table.SetColVisibleWidth("客户编码|80|料品编码|75|料品名称|85|料品规格|360|包装方式|60|国家|85|客人|90|料品类别|65|单位|35|规格备注|350")
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 13:43:00
--
此主题相关图片如下:qq图片20130729134210.jpg
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 14:12:00
--
现在改为以下的代码,不提示以上错误了,但提示另外的错识,真的很奇怪的,不知是什么原因,请问有那位能指正?
Dim s As String = e.Form.Controls("TextBox2").Text Dim t As WinForm.Table = e.Form.Controls("Table1") If s = "" Then s = "" Else s = s & "%" \'tbl.Filter = "item_no Like" & txt End If t.Table.Fill("select DISTINCT {obas_part1}.part_no,{obas_part}.item_no As 料品编码,{obas_part_spec}.cu_part_no As 客户编码,type_name As 料品类别,part_name As " & _ "料品名称,part_spec As 料品规格,base_name As 单位,{obas_part_spec}.wf_cp_ggrem As 规格备注,wf_cp_gz As 国家,wf_cp_kr As 客人,wf_bz_fs As 包装方式 From ((({obas_part}" & _ "Inner JOIN {obas_part} ON {obas_part1}.part_no = {obas_part}.part_no) Inner JOIN {obas_part_type} ON {obas_part1}.part_type = {obas_part_type}.type_no ) Inner JOIN " & _ "{obas_base_code} ON {obas_base_code}.base_code = {obas_part1}.unit_no) left JOIN {obas_part_spec} on {obas_part1}.part_no= {obas_part_spec}.part_no where" & _ "{obas_base_code}.code_type = \'115\' and {obas_part1}.part_type Like \'1%\' and {obas_part_spec}.cu_part_no Like \'" & s & "\'or {obas_base_code}.code_type =\'115\' and " & _ "{obas_part1}.part_type Like \'1%\' and {obas_part.item_no} like \'" & s & "\' Order By {obas_part}.item_no","erp",True)
t.Table.SetColVisibleWidth("客户编码|80|料品编码|75|料品名称|85|料品规格|360|包装方式|60|国家|85|客人|90|料品类别|65|单位|35|规格备注|350")
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 14:13:00
--
此主题相关图片如下:qq截图20130729141225.png
经我检查,数据源设置没问题,唉,到底是何原因?
[此贴子已经被作者于2013-7-29 14:15:34编辑过]
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 14:23:00
--
经用各种方法测试都不行,真的很奇怪,原代码自去年以来一直正常使用,直的今天才出现错识提示,真的不知是何原因,原代码如下所示,不知道有没问题?
Try Dim s As String = e.Form.Controls("TextBox2").Text Dim t As WinForm.Table = e.Form.Controls("Table1") If s = "" Then s = "" Else s = s & "%" \'tbl.Filter = "item_no Like" & txt End If t.Table.Fill("select DISTINCT obas_part1.part_no,obas_part.item_no As 料品编码,obas_part_spec.cu_part_no As 客户编码,type_name As 料品类别,part_name As 料品名称,part_spec As 料品规格,base_name As 单位,obas_part_spec.wf_cp_ggrem As 规格备注,wf_cp_gz As 国家,wf_cp_kr As 客人,wf_bz_fs As 包装方式 From obas_part1 Inner JOIN obas_part ON obas_part1.part_no = obas_part.part_no Inner JOIN obas_part_type ON obas_part1.part_type = obas_part_type.type_no Inner JOIN obas_base_code ON obas_base_code.base_code = obas_part1.unit_no left JOIN obas_part_spec on obas_part1.part_no= obas_part_spec.part_no where obas_base_code.code_type =\'115\'and obas_part1.part_type Like \'1%\'and obas_part_spec.cu_part_no Like \'"& s & "\'or obas_base_code.code_type =\'115\'and obas_part1.part_type Like \'1%\'and obas_part.item_no like \'" & s & "\' Order By obas_part.item_no","erp",True) t.Table.SetColVisibleWidth("客户编码|80|料品编码|75|料品名称|85|料品规格|360|包装方式|60|国家|85|客人|90|料品类别|65|单位|35|规格备注|350")
Catch ex As Exception End Try
|
-- 作者:lsy
-- 发布时间:2013/7/29 14:35:00
--
你这语句,只看前几行,效率很低。
后面一大段Fill,没有实例,没办法测试,更没办法为你改写。
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 14:40:00
--
以下是引用lsy在2013-7-29 14:35:00的发言:
你这语句,只看前几行,效率很低。
后面一大段Fill,没有实例,没办法测试,更没办法为你改写。
请问语法有没问题? 以前能用的语句中是没{}符号的,但按说明书所说应该是要{}的且来于多个表的时候还要有join前还要有括号的,请问是这样吗?
|
-- 作者:lsy
-- 发布时间:2013/7/29 14:45:00
--
最好是有实例,一步步的试,才晓得错在哪儿。
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 15:01:00
--
以下是引用lsy在2013-7-29 14:45:00的发言:
最好是有实例,一步步的试,才晓得错在哪儿。
因数据比较大和复杂,能否帮我QQ远程试一下?
|
-- 作者:yankunhao
-- 发布时间:2013/7/29 15:18:00
--
现在真的怀疑foxtable 的Fill的SQL有问题,按说明的说法"
再次提示:SQL语句中的表名必须用大括号括起来,这是Foxtable的一个非常特殊的要求。 " 加{}不行,反而没{}就行,换了一台服务器,将数据库搬过来,有些地方行,有些地方不行,真的很有问题。
[此贴子已经被作者于2013-7-29 15:22:09编辑过]
|