delphi中 Query的SQL语句太长时编译不通过,怎么办?
如:“Query1.SQL.Text:='selectfahuoriqias发货日期,yonghumingchengas用户名称,huowumingchengas货物名称...
如:“Query1.SQL.Text:='select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票,shouhuodizhi as 收货地址, shouhuorenjidianhua as 收货人及电话 from 发货记录.db where yonghumingcheng =:mingcheng';”编译不通过,而“Query1.SQL.Text:='select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票 from 发货记录.db where yonghumingcheng =:mingcheng';”编译能通过,请问怎样解决,谢谢。
展开
2个回答
展开全部
首先检查此语句正确吗?有没有输入错误。
Query1.SQL.Text:='select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票 from 发货记录.db where yonghumingcheng =:mingcheng';
再测试SQL语句正确否:
select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票 from 发货记录.db where yonghumingcheng =:mingcheg;
字符段变量有没有错!
若能通过则编译也能通过。
Query1.SQL.Text:='select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票 from 发货记录.db where yonghumingcheng =:mingcheng';
再测试SQL语句正确否:
select fahuoriqi as 发货日期, yonghumingcheng as 用户名称, huowumingcheng as 货物名称, guigexinghao as 规格型号,jiliangdanwei as 计量单位, shuliang as 数量, weikaifapiao as 未开发票 from 发货记录.db where yonghumingcheng =:mingcheg;
字符段变量有没有错!
若能通过则编译也能通过。
追问
谢谢,太长用分段表示后己经解决,“a ”+“ b”+....
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询