利用UltraEdit快速将SQL语句转换为符合VB.NET语法格式字符串

实习中时常需要将写好的SQL语句嵌入到VB.NET的函数中,例如将下列SQL:
ContractedBlock.gif ExpandedBlockStart.gif -- Get Mother Lot Common Info
None.gifselect c.customerlotnumber -- customer lot#
None.gif
,c.containername --Amkor lot#,
None.gif
,amk.description
None.gif,inh.txndate indate
--s_time
None.gif
,outh.txndate  outdate -- e-time
None.gif
,rs.resourcename resourcename
None.gif,emp.fullname
None.gif

-- ,outh.qty
None.gif
from container c,historymainline hml,workflowstep wfs
None.gif,operation opt,movehistory outh,moveinhistory inh
None.gif,RESOURCEDEF rs
None.gif,amkorwwoper amk
None.gif,employee emp
None.gif




where c.splitfromid =(select containerid from container where
None.gifcontainername
='ML6410058461')
None.gif
and hml.reversalstatus=1
None.gif
and c.containerid=hml.containerid
None.gif
and hml.operationid=opt.operationid
None.gif
and hml.workflowstepid=wfs.workflowstepid
None.gif
and hml.operationid=opt.operationid
None.gif
and hml.historymainlineid=inh.historymainlineid(+)
None.gif
and hml.historymainlineid=outh.historymainlineid(+)
None.gif
and HMl.RESOURCEID=RS.RESOURCEID(+)
None.gif
and (outh.historymainlineid is not null or inh.historymainlineid is not null)
None.gif
and opt.amkorwwoperid=amk.amkorwwoperid
None.gif
and hml.employeeid=emp.employeeid
None.gif
order by c.containername,to_number(wfs.sequence),inh.txndate,outh.txndate

转换如下形式为:
ContractedBlock.gif ExpandedBlockStart.gif String sql in VB.NET
None.gifsql = "select c.customerlotnumber -- customer lot# " & vbCrLf _  
None.gif  
& ",c.containername --Amkor lot#, " & vbCrLf _  
None.gif  
& ",amk.description " & vbCrLf _  
None.gif  
& ",inh.txndate indate--s_time " & vbCrLf _  
None.gif  
& ",outh.txndate  outdate -- e-time " & vbCrLf _  
None.gif  
& ",rs.resourcename resourcename " & vbCrLf _  
None.gif  
& ",emp.fullname " & vbCrLf _  
None.gif  
& "-- ,outh.qty " & vbCrLf _  
None.gif  
& "from container c,historymainline hml,workflowstep wfs " & vbCrLf _  
None.gif  
& ",operation opt,movehistory outh,moveinhistory inh " & vbCrLf _  
None.gif  
& ",RESOURCEDEF rs " & vbCrLf _  
None.gif  
& ",amkorwwoper amk " & vbCrLf _  
None.gif  
& ",employee emp " & vbCrLf _  
None.gif  
& "where c.splitfromid =(select containerid from container where " & vbCrLf _  
None.gif  
& "containername='ML6410058461') " & vbCrLf _  
None.gif  
& "and hml.reversalstatus=1 " 'dot.gif..

同事Tracy告诉我一个快速方法,仅仅利用UltraEdit的 查找替换功能(<>号不填,仅为引用号),
查找:< ^p >
替换:<  " & vbCrLf _  ^p  & " >
替换的第一个"号前不可省去空格,然后填上头尾即可,^p代表回车符,也就是将回车符展开,是不是很有趣的技巧? 555134.html

丁丁 2006-11-09 11:52 发表评论







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值