网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > SQL技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
本月文章推荐
.教你轻松恢复/修复SQL Server的M.
.SQL Server数据库占用过多内存的.
.SQL Server自动备份无法删除过期.
.把SQL数据库部署到远程数据库服务.
.您的SQL Server应用程序查询正在.
.SQL Server 2005 创建登录时提示.
.分页存储过程.
.SQL Server静态页面导出技术4.
.SQL扩展存储过程安装与卸载 .
.全文本检索的应用(2).
.SQL Server中索引使用及维护.
.SQL Server实用经验与技巧大汇集.
.SQL Server数据库文件恢复技术.
.轻松掌握密码有效性验证失败的处.
.在SQL Server中通过.NET远程的执.
.快速了解分布式数据库的主要特点.
.SQLServer中有关SQLAgent的使用技.
.关于sql server下无限多级别分类.
.net在sql server中的图片存取技术.
.三步堵死SQL注入漏洞.

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

发表日期:2006-11-10


实习中时常需要将写好的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

上一篇:用SQL语句实现异构数据库之间的导数据导入/出 人气:5769
下一篇:优化SQL Server服务器内存配置的策略 人气:5713
浏览全部SQL语句转换为符合VB.NET语法格式字符串的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐