易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL链接数据库

Standard   Security:  
   
  "Data   Source=Aron1;Initial  
Catalog=pubs;User   Id=sa;Password=asdasd;"    
        -   or   -  
 
"Server=Aron1;Database=pubs;User  
ID=sa;Password=asdasd;Trusted_Connection=False"    
        (both  
connection   strings   produces   the   same   result)  
   
   
   
   
    Trusted   Connection:  
   
  "Data  
Source=Aron1;Initial   Catalog=pubs;Integrated   Security=SSPI;"    
       
-   or   -  
  "Server=Aron1;Database=pubs;Trusted_Connection=True;"    
        (both   connection   strings   produces   the   same   result)  
   
  (use   serverName\instanceName   as   Data   Source   to   use  
an   specifik   SQLServer   instance)  
    Connect   via   an   IP  
address:  
  "Data   Source=190.190.200.100,1433;Network  
Library=DBMSSOCN;Initial   Catalog=pubs;User   ID=sa;Password=asdasd;"    
 
(DBMSSOCN=TCP/IP   instead   of   Named   Pipes,   at   the   end   of   the  
Data   Source   is   the   port   to   use   (1433   is   the   default))  
    Enabling   MARS   (multiple   active   result   sets):  
   
 
"Server=Aron1;Database=pubs;Trusted_Connection=True;MultipleActiveResultSets=true"
   
  Note!   Use &nbs


相关文档:

C++通过ADO连接ACCESS(或者SQL Server)数据库例子

#include "iostream.h"
#include "stdio.h"
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
int main(int argc, char* argv[])
{
   ::CoInitialize(NULL);
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
tr ......

SQL中case when的两种使用方法示例

Case具有两种格式。简单Case函数和Case搜索函数。
--简单Case函数
CASE sex
         WHEN '1' THEN '男'
         WHEN '2' THEN '女'
ELSE '其他' END
--Case搜索函数
CASE WHEN sex = '1' THEN '男'
  &nbs ......

SQL SERVER跨服务器查询(SQL SERVER DBLINK)

--跨服务器查询如下:
SELECT a.*,b.stor_Name
from OPENROWSET('MSDASQL',
   'DRIVER={SQL Server};SERVER=tom;UID=sa;PWD=123',
   pubs.dbo.authors) AS a,stores b
ORDER BY a.au_lname, a.au_fname
--其中,tom为远程服务器名,stores 是本机数据库pubs中的表
--需要注意的是若二个表中的 ......

sql中的分段列表

表:用户号码,登录时间
显示 :每日登录各时间段的登录人数,和每天登录人数
if isnull(object_id('#tb'),'')=''
drop table #tb
CREATE TABLE #tb(列名1 varchar(12),时间 datetime)
INSERT INTO #tb
SELECT '03174190188','2009-11-01 07:17:39.217' UNION ALL
SELECT '015224486575','2009-11-01 08:01:17.153' ......

简单的 sql分页存储过程

【1】
create procedure proc_pager1  
(   @pageIndex int, -- 要选择第X页的数据 
    @pageSize int -- 每页显示记录数 
)  
AS 
BEGIN 
   declare @sqlStr varchar(500)  
   set @sqlStr='select top '+con ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号