利用UltraEdit快速将SQL语句转换为符合VB.NET语法格式字符串
敬业的IT人
互联网
佚名
2008-5-23 21:11:50
实习中时常需要将写好的SQL语句嵌入到VB.NET的函数中,例如将下列SQL:
-- Get Mother Lot Common Info
select c.customerlotnumber -- customer lot#
,c.containername --Amkor lot#,
,amk.description
,inh.txndate indate--s_time
,rs.resourcename resourcename
,emp.fullname
-- ,outh.qty
from container c,historymainline hml,workflowstep wfs
,operation opt,movehistory outh,moveinhistory inh
,RESOURCEDEF rs
,amkorwwoper amk
,employee emp
where c.splitfromid =(select containerid from container where
containername='ML6410058461')
and hml.reversalstatus=1
and c.containerid=hml.containerid
and hml.operationid=opt.operationid
and hml.workflowstepid=wfs.workflowstepid
and hml.operationid=opt.operationid
and hml.historymainlineid=inh.historymainlineid(+)
and hml.historymainlineid=outh.historymainlineid(+)
and HMl.RESOURCEID=RS.RESOURCEID(+)
and (outh.historymainlineid is not null or inh.historymainlineid is not null)
and opt.amkorwwoperid=amk.amkorwwoperid
and hml.employeeid=emp.employeeid
order by c.containername,to_number(wfs.sequence),inh.txndate,outh.txndate
转换如下形式为:
String sql in VB.NET
sql = "select c.customerlotnumber -- customer lot# " & vbCrLf _
& ",c.containername --Amkor lot#, " & vbCrLf _
& ",amk.description " & vbCrLf _
& ",inh.txndate indate--s_time " & vbCrLf _
& ",outh.txndate outdate -- e-time " & vbCrLf _
& ",rs.resourcename resourcename " & vbCrLf _
& ",emp.fullname " & vbCrLf _
& "-- ,outh.qty " & vbCrLf _
& "from container c,historymainline hml,workflowstep wfs " & vbCrLf _
& ",operation opt,movehistory outh,moveinhistory inh " & vbCrLf _
& ",RESOURCEDEF rs " & vbCrLf _
& ",amkorwwoper amk " & vbCrLf _
& ",employee emp " & vbCrLf _
& "where c.splitfromid =(select containerid from container where " & vbCrLf _
& "containername='ML6410058461') " & vbCrLf _
& "and hml.reversalstatus=1 " '..
同事Tracy告诉我一个快速方法,仅仅利用UltraEdit的查找替换功能(<>号不填,仅为引用号),
查找:< ^p >
替换:< " & vbCrLf _ ^p & " >
替换的第一个"号前不可省去空格,然后填上头尾即可,^p代表回车符,也就是将回车符展开,是不是很有趣的技巧?
http://www.cnblogs.com/ericguo/archive/2006/11/09/555134.html
进入讨论组讨论。- 最新文章
- 在VS2005中调试WindowsService[05-23]
- Visual Basic和C#中的LINQ聚合[05-23]
- Visual Basic.Net基础概念和语法[05-23]
- Visual Basic 9.0隐式类型的局部变量[05-23]
- 关于Visual Basic 9.0动态接口[05-23]
- 怎样在VB.NET中实现窗体控件数据集绑定[05-23]
- 相关文章
- 怎样在VB.NET中实现窗体控件数据集绑定[05-23]
- VB.NET下的事件和委托[05-23]
- Linq to Sql: 集成数据库语言查询之二[05-23]
- Linq to Sql: 集成数据库语言查询之一[05-23]
- ADO.Net学习笔记——DataAdapter更新数据库记..[05-23]
- 关于 VB.NET 的 My 功能[05-23]
