程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> 利用UltraEdit快速將SQL語句轉換為符合VB.NET語法格式字符串

利用UltraEdit快速將SQL語句轉換為符合VB.NET語法格式字符串

編輯:Oracle數據庫基礎

實習中時常需要將寫好的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
,outh.txndate  outdate -- e-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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved