易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : sql

特殊SQL语句

1.查询连接到某数据库的连接数
   select   count(*)   as   连接数   from   master..sysprocesses   where   db_name(dbid)='数据库名' ......

SQL数据库连接语句

一般的远程访问的写成这样:
Data Source=IP;Initial Catalog=数据库名;UserID=用户名;Password=密码
本地访问的写成这样:
Data Source=(local);Initial Catalog=数据库名;UserID=用户名;Password=密码
如果是本地的,通过windows组件验证的(也就是没有用户名,密码的)写成这样:
Data Source=(local);Initial Catalog=数据库名;Integrated Security=True
如果不是默认的实例,假如实例名是SQLEXPRESS,写成这样:
Data Source=(local)\SQLEXPRESS;Initial Catalog=数据库名;Integrated Security=True
ExecuteReader
简单高效的,单向前的数据查询。返回一个SqlDataReader对象
通常用于读取数据
ExecuteNonQuery
返回一个int类型的值,返回数据库中所影响的行数。
用于对数据库的各种操作
ExecuteScalar
返回读出结果的第一行第一列
 WorkflowIdled 事件
.NET Framework 类库
WorkflowRuntime..::.WorkflowIdled 事件
更新:2007 年 11 月
在工作流实例进入空闲状态后发生
static void Main()
{
    string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI; ......

在SQL Server2005中有如下四个排名函数

排名函数是SQL Server2005新加的功能。在SQL Server2005中有如下四个排名函数:
  1.row_number
  2.rank
  3.dense_rank
  4.ntile  
  下面分别介绍一下这四个排名函数的功能及用法。在介绍之前假设有一个t_table表,表结构与表中的数据如图1所示:
  图1
  其中field1字段的类型是int,field2字段的类型是varchar
  一、row_number
  row_number函数的用途是非常广泛,这个函数的功能是为查询出来的每一行记录生成一个序号。row_number函数的用法如下面的SQL语句所示:
select row_number() over(order by field1) as row_number,* fromt_table
  上面的SQL语句的查询结果如图2所示。
  图2
  其中row_number列是由row_number函数生成的序号列。在使用row_number函数是要使用over子句选择对某一列进行排序,然后才能生成序号。
  实际上,row_number函数生成序号的基本原理是先使用over子句中的排序语句对记录进行排序,然后按着这个顺序生成序号。over子句中的order by子句与SQL语句中的order by子句没有任何关系,这两处的order by 可以完全不同,如下面的SQL语句所示
select row_number() over(order by field2 desc) as ro ......

更改Sql*plus的提示符

  正常登陆sql*plus的步骤如下:
sbdatabase*orcl-/home/oracle>sqlplus /nolog
SQL*Plus: Release 10.2.0.3.0 - Production on Sun May 9 19:50:24 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
SQL> conn hmsimis/test@orcl
Connected.
SQL>
可以看到前面的提示符是SQL,现在想修改提示的内容,该怎么办?在oracle10g中已经为我们提供了几个预先定义的变量可以让我们用来显示,比如下面这样:
SQL> define
DEFINE _DATE = "09-MAY-10" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "orcl" (CHAR)
DEFINE _USER = "HMSIMIS" (CHAR)
DEFINE _PRIVILEGE = "" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1002000300" (CHAR)
DEFINE _EDITOR = "vi" (CHAR)
DEFINE _O_VERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options" (CHAR)
DEFINE _O_RELEASE = "1002000300" (CHAR)
SQL>
   通过set sqlprompt 命令,可以修改现实的内容, 比如像下面这样:
SQL> set sqlprompt '_US ......

Sybase的SQL Anywhere for BlackBerry

UltraLite®J:BlackBerry上运行的小数据库和同步引擎
MobiLink :运行在服务器上数据库同步服务器,可以把设备上的数据同步到后台的。包含在SQL Anywhere 11里面。
SQL Anywhere 是业内领先的移动和嵌入式数据库,提供数据管理和交换技术,为一线环境中的应用程序提供支持。
SQL Anywhere 专为不具备现场 IT 支持、在一线环境中运行、由数据库驱动的应用程序提供数据管理和交换技术。在一个可轻松嵌入并广泛部署在服务器、桌面、远程办公室和移动应用程序内的数据库中,它可提供企业级的功能。
SQL Anywhere for BlackBerry中文
http://www.sybase.com.cn/products/databasemanagement/sqlanywhere/blackberry
SQL Anywhere for BlackBerry英文
http://www.sybase.com/products/databasemanagement/sqlanywhere/blackberry
SQL Anywhere中文网站
http://www.sybase.com.cn/products/databasemanagement/sqlanywhere
题外话,1997年-98年,曾经使用过当时流行的Sybase PowerBuild和ORACLE数据库进行海港集装箱货运管理系统的开发。
开发中单机测试的数据库就是用SQL Anywhere for Windows 98。
大概是1999年吧,B/S架构流行,Sybase的C/S王牌开发工具PowerBuil ......

Asp.Net中sql server 2000/2005 连接字符串


http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
在后台代码里:
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong");
在web.config里:
sql 2000:
<connectionStrings>
    <add name="RateSystemConnectionString" connectionString="Data Source=.;Initial atalog=RateSystem;
   User ID=sa Pwd=sa" providerName="System.Data.SqlClient" />
</connectionStrings>
sql 2005:
<connectionStrings>
   <add name="BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;
Initial Catalog=BookShop;Integrated  Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
/////////////////////////////////////////////
<connectionStrings>
    <add name="ConnectionString" providerName="System.Da ......

Asp.Net中sql server 2000/2005 连接字符串


http://zhanglei1286.blog.163.com/blog/static/1895797120091112113019600/
在后台代码里:
SQL 2000:
static string StrConn = "server=.;uid=sa;pwd=sa;database=MyCUDS";
SQL2005:
con = new SqlConnection(@"Server=.\SQLExpress;Database=db_CMS;Persist Security Info=True;User ID=sa;Password=Masslong");
在web.config里:
sql 2000:
<connectionStrings>
    <add name="RateSystemConnectionString" connectionString="Data Source=.;Initial atalog=RateSystem;
   User ID=sa Pwd=sa" providerName="System.Data.SqlClient" />
</connectionStrings>
sql 2005:
<connectionStrings>
   <add name="BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;
Initial Catalog=BookShop;Integrated  Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
/////////////////////////////////////////////
<connectionStrings>
    <add name="ConnectionString" providerName="System.Da ......
总记录数:4346; 总页数:725; 每页6 条; 首页 上一页 [95] [96] [97] [98] 99 [100] [101] [102] [103] [104]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号