字符串中写SQL语句...
你是否遇到过 想在 字符串里面写 SQL语句,但是总是遇到 某些符号不会写.
比如说在字符串里面写个变量.
like: str sql="select * from abc where id= ' "++" ' "
id的变量应 先用单引号然后“+”号。
今天遇到个很长的SQL语句,而且SQL语句里面嵌套了字符串。当时根本不会写,后来在同事帮助下,终于解决了。
方法:
不管字符串多长,只要记住 如果是个变量 就写成 "+变量+"。其它一切不动。
例子:
else if(DB.getFirst("select parentcategoryid from category where categoryid in
("
+
DB.getFirst("select parentcategoryid from category where categoryid=" +
EnMapArray[cnum] + "
")+"
)") == DB.getFirst("select parentcategoryid from category where categoryid in ("+DB.getFirst("select parentcategoryid from category where categoryid=" + EnMapArray[EnMapArray.Length - 1] + "")+")"))
相关文档:
【引用:猛犸技术文章摘要
】
经测试,方法二可成功删除数据,方法一、三 删除数据失败。请路过的朋友,指点迷津。。。
问题:一个表有自增的ID
列,表中有一些记录内容重复,也就是说这些记录除了ID
不同之外,其他的信息都相同。需要把重复的记录保留一条,剩下的删除
方法一:还是2000
年的时候一位Oracl ......
treeview.aspx中代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="treeview.aspx.cs" Inherits="treeview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999 ......
通过v$sqlarea,v$sql查询最占用资源的查询 收藏
引用:http://blog.chinaunix.net/u/3866/showart_396335.html
-----------------------
v$sqlarea,v$sql
-----------------------
从V$SQLAREA中查询最占用资源的查询
select b.username username,a.disk_reads reads,
a.executions exec,a ......