.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
{
/**//// <summary>
/// Summary description for SqlInfo.
/// </summary>
public class SqlInfo
{
³ÉÔ±±äÁ¿#region ³ÉÔ±±äÁ¿
private string _uid="";
private string _pwd="";
private StringCollection _serverList=new StringCollection();
private Hashtable _databaseList=new Hashtable();
#endregion
¹¹Ô캯Êý#region ¹¹Ô캯Êý
public SqlInfo()
{
this._serverList=GetSqlInstances();
&nb
Ïà¹ØÎĵµ£º
SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓã¨ËÄ£©
×÷Õߣºfreedk
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¶þ¡¢¸ÄÉÆSQLÓï¾ä
Èý¡¢ÊµÏÖСÊý¾ÝÁ¿ºÍº£Á¿Êý¾ÝµÄͨÓ÷ÖÒ³ÏÔʾ´æ´¢¹ý³Ì
¾Û¼¯Ë÷ÒýµÄÖØÒªÐÔºÍÈçºÎÑ¡Ôñ¾Û¼¯Ë÷Òý
¡¡¡¡ÔÚÉÏÒ»½ÚµÄ±êÌâÖУ¬±ÊÕßдµÄÊÇ£ºÊµÏÖСÊý¾ÝÁ¿ºÍº£Á¿Êý¾ÝµÄͨÓ÷ÖÒ³ÏÔʾ´æ´¢¹ý³Ì¡£ÕâÊÇÒòΪÔÚ½«±¾´æ´¢¹ý³ÌÓ¦ÓÃÓÚ“°ì¹«×Ô¶ ......
SQLʱ¼ä¶Î²éѯ
ACCESSµÄ»°
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQLµÄ»°
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
Ò²¿ÉÒÔ
select * from table where date1 between '2008-1-20' and '2007-3-30'
ÆäÖÐdate1,date2¶¼ÊÇÈÕÆÚÀàÐ͵Ä× ......
ÔÚ¿ª·¢²»ÂÛÊÇWEB»¹ÊÇWinform³ÌÐòÖУ¬Êý¾Ý·ÖÒ³ÊǾ³£Óöµ½µÄÎÊÌ⣬ҪÊÇÔÚ´úÂëÖÐʵÏִ˹ý³Ì£¬ÏÔÈ»½µµÍÁË·þÎñÆ÷µÄЧÂÊ£¬¿ÉÒÔʹÓÃÒÔÏ´洢¹ý³ÌÀ´ÊµÏÖ¡£
CREATE PROCEDURE pagination
@tblName varchar(255), -- ±íÃû
@strGetFields varchar(1000) = '*', -- ÐèÒª·µ»ØµÄÁÐ
@fldName varchar(255)= ......
¸ÕÅöµ½Õâ¸öÎÊÌâʱ£¬ÒÔΪÊÇÓ¦Ó÷þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷ûÁ¬Í¨£¬²éÁË°ëÌìµÄÍøÂç½á¹ûÍøÉÏÒ»²é£¬¸úSQL Server 2005Óйأ¬ÄãÌ«ÑôµÄ£¡
¿ªÊ¼²Ëµ¥-SQLServer2005-ÅäÖù¤¾ß-SQL Server Configuration Manager-SQLserver2005ÍøÂçÅäÖÃ-MSSQLSERVERµÄÐÒé-Ë«»÷TCP/IPÐÒé
°ÑIP¸Ä³Éµ±Ç°Ê¹Óõģ¬µ±È»£¬¶Ë¿ÚҲҪȷ±£ ......