Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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

.netÁ¬½Ósql server

Êý¾Ý¿âÃû£ºEmployee
±íÃû£ºEmployees
uid£ºsa
pwd£ºsa
ÎÊÌâ²¹³ä£º
×îºÃÊÇÌṩSQL SERVER½Ó¿Ú·ÃÎÊÊý¾Ý¿âµÄ´úÂë
Õâ¶Î´úÂëÊÇVS.NET×Ô¶¯Éú³É£¬ÀïÃæÓÐÄÄЩÊDz»ÐèÒªµÄÄØ£¿Ó¦¸Ã°ÑÊý¾Ý¿âÁ¬½ÓµÄ´úÂë·ÅÔÚÄĸöµØ·½ÄØ£¿
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>WebForm3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">
</form>

</body>
</html>
landy543210 µÄ»Ø´ðÊǶԵģ¬²»¹ýÓÐЩÎÊÌ⣺
1¡¢ºÜÏÔÈ»LZÔÚwebÓ¦ÓóÌÐ ......

¾­µäSQLÓï¾ä´óÈ«

ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
¡¡¡¡2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
¡¡¡¡3¡¢ËµÃ÷£º±¸·Ýsql server
¡¡¡¡--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
¡¡¡¡--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
¡¡¡¡4¡¢ËµÃ÷£º´´½¨Ð±í
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
¡¡¡¡¸ù¾ÝÒÑÓÐµÄ±í´´½¨ÐÂ±í£º
A£ºcreate table tab_new like tab_old (ʹÓÃ¾É±í´´½¨Ð±í)
B£ºcreate table tab_new as select col1,col2… from tab_old definition only
¡¡¡¡5¡¢ËµÃ÷£º
¡¡¡¡É¾³ýÐÂ±í£ºdrop table tabname
¡¡¡¡6¡¢ËµÃ÷£º
¡¡¡¡Ôö¼ÓÒ»¸öÁУºAlter table tabname add column col type
¡¡¡¡×¢£ºÁÐÔö¼Óºó½«²»ÄÜɾ³ý¡ ......

SQL SERVERÊý¾Ý¿âÖÐµÄ±í±¸·Ý³ÉÎı¾

--×÷ÓãºÊý¾Ý¿âÖÐµÄ±í±¸·Ý³ÉÎı¾
Declare @tabname varchar(200),@ip varchar(50),@user varchar(50),@password varchar(50),@sql varchar(1000),@filetxt varchar(200),@file varchar(50)
set @tabname='database.dbo.tb' --±íÃû
set @ip='127.0.0.1'  --IPµØÖ·£¬±¾»úµÄ»°¾Íд127.0.0.1
set @user='sa'   --Êý¾Ý¿âÓû§Ãû
set @password='123'  --Êý¾Ý¿âÃÜÂë
set @file='c:\'   --±¸·Ý·¾¶
set @filetxt='tb.txt'  --±¸·ÝÎļþÃû
set @sql='Bcp '+@tabname+' out '+@file+@filetxt+' -S '+@ip+' -U '+@user+' -P '+@password+' -t \t -c'
Print @sql
Exec master..xp_cmdshell @sql,No_Output ......

sql server ´æ´¢¹ý³ÌʵÏÖ·ÖÒ³

     ÔÚ¿ª·¢²»ÂÛÊÇWEB»¹ÊÇWinform³ÌÐòÖУ¬Êý¾Ý·ÖÒ³ÊǾ­³£Óöµ½µÄÎÊÌ⣬ҪÊÇÔÚ´úÂëÖÐʵÏִ˹ý³Ì£¬ÏÔÈ»½µµÍÁË·þÎñÆ÷µÄЧÂÊ£¬¿ÉÒÔʹÓÃÒÔÏ´洢¹ý³ÌÀ´ÊµÏÖ¡£
CREATE PROCEDURE pagination
@tblName varchar(255), -- ±íÃû
@strGetFields varchar(1000) = '*', -- ÐèÒª·µ»ØµÄÁÐ
@fldName varchar(255)='', -- ÅÅÐòµÄ×Ö¶ÎÃû
@PageSize int = 10, -- Ò³³ß´ç
@PageIndex int = 1, -- Ò³Âë
@doCount bit = 0, -- ·µ»Ø¼Ç¼×ÜÊý, ·Ç 0 ÖµÔò·µ»Ø
@OrderType bit = 0, -- ÉèÖÃÅÅÐòÀàÐÍ, ·Ç 0 ÖµÔò½µÐò
@strWhere varchar(1500) = '' -- ²éѯÌõ¼þ (×¢Òâ: ²»Òª¼Ó where)
AS
declare @strSQL varchar(5000) -- Ö÷Óï¾ä
declare @strTmp varchar(110) -- ÁÙʱ±äÁ¿
declare @strOrder varchar(400) -- ÅÅÐòÀàÐÍ
if @doCount != 0
begin
if @strWhere !=''
set @strSQL = 'select count(*) as Total from [' + @tblName + '] where '+@strWhere
else
set @strSQL = 'select count(*) as Total from [' + @tblName + ']'
end
--ÒÔÉÏ´úÂëµÄÒâ˼ÊÇÈç¹û@doCount´«µÝ¹ýÀ´µÄ²»ÊÇ0£¬¾ÍÖ´ÐÐ×ÜÊýͳ¼Æ¡£ÒÔϵÄËùÓдúÂ붼ÊÇ@doCountΪ0µÄÇé¿ö
e ......

SQL Server 2005 ÎÊÌ⣺TCP/IPÎÞ·¨Á¬½Ó

 ¸ÕÅöµ½Õâ¸öÎÊÌâʱ£¬ÒÔΪÊÇÓ¦Ó÷þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷ûÁ¬Í¨£¬²éÁË°ëÌìµÄÍøÂç½á¹ûÍøÉÏÒ»²é£¬¸úSQL Server 2005Óйأ¬ÄãÌ«ÑôµÄ£¡
  ¿ªÊ¼²Ëµ¥-SQLServer2005-ÅäÖù¤¾ß-SQL Server Configuration Manager-SQLserver2005ÍøÂçÅäÖÃ-MSSQLSERVERµÄЭÒé-Ë«»÷TCP/IPЭÒé
  °ÑIP¸Ä³Éµ±Ç°Ê¹Óõģ¬µ±È»£¬¶Ë¿ÚҲҪȷ±£ÕýÈ·¡£ÔÙÖØÆôÊý¾Ý¿â£¬¾ÍOKÁË¡£¸ÄÁËIPµØÖ·£¬SQLServer¾ÓÈ»²»»á×Ô¶¯Ð޸ģ¬Õæ´À£¬ÔÙÌ«ÑôÒ»´ÎMS ......

.NET »ñÈ¡¾ÖÓòÍøµÄsql server Áбí

SqlDataSourceEnumerator instance =SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();
»ò
System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();
·µ»ØDatatable
´Ëtable°üº¬ÒÔÏÂËĸö×Ö¶Î
Console.WriteLine("·þÎñÆ÷Ãû = {0}", row["ServerName"]);
Console.WriteLine("ʵÀýÃû = {0}", row["InstanceName"]);
Console.WriteLine("ÊÇ·ñ¼¯³ÉÑéÖ¤ = {0}", row["IsClustered"]);//¼´WindowsÉí·ÝÑéÖ¤ºÍSQL ServerÑéÖ¤
Console.WriteLine("°æ±¾ = {0}", row["Version"]);//8.*ÊÇSQL 2000,9.*ÊÇSQL 2005
·½·¨Ò»£ºÍ¨¹ýMicrosoft.SQLDMO.Object×é¼þ¾Í¿ÉÒÔÇáËÉÍê³É´ËÏ×÷£º
Ê×ÏÈÈçºÎÕÒµ½Microsoft.SQLDMO.Object
1.ÈçºÎÔÚÄúµÃÏîÄ¿ÖÐÄܹ»Ê¹ÓÃSQLDMO×é¼þ£¿
²Ëµ¥£­ÏîÄ¿£­Ìí¼ÓÒýÓã­COM-Microsoft.SQLDMO.Object
2.½«¸Ã¹¦ÄÜд³ÉÒ»¸öÀࣺ
using System;
using System.Collections;
using System.Collections.Specialized;
namespace JillZhang
{
&nb ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [715] [716] [717] [718] 719 [720] [721] [722] [723] [724]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ