网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> VB编程 >> 文章正文
  将SQL语句转换为符合VB.NET格式字符串            【字体:
将SQL语句转换为符合VB.NET格式字符串
作者:佚名    文章来源:不详    点击数:    更新时间:2007-9-12    
正在装载数据……

将SQL语句转换为符合VB.NET格式字符串

实习中时常需要将写好的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://blog.csdn.net/washingto/archive/2007/08/26/1759697.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     如何在ado中使用connect…
     vb 贪吃蛇 单人版游戏 (…
     关于在vb中进行com组件的…
     用vb6.0编写自我升级的程…
     vb自动登陆网络站点详解…
     vb打造超酷个性化菜单(…
  • weblogic 9.1的domain配置my…

  • javabean+mysql数据库连接池

  • SQLite我选择我喜欢!

  • Oracle SQL语句查询例子

  • 数据库使用MSSQL固定情况下调…

  • 配制HSQLDB数据库

  • 【自制视频】Java连接MySQL

  • NetBeans 5.5 可视化JSF开发…

  • J2EE程序中的SQL语句自动构造…

  • web.xml语句顺序问题

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David