.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
Ïà¹ØÎĵµ£º
ǰÑÔ
Å©ÒµÒøÐÐ×ÜÐÐ1998ÄêÒÔÀ´ÕýÊ½ÍÆ¹ãÁËаæÍøÂç°æ×ÛºÏÒµÎñͳ¼ÆÐÅϢϵͳ£¬¸ÃϵͳÊÇ»ùÓÚWindowsNT4.0ƽ̨£¬²ÉÓÿͻ§£¯·þÎñÆ÷ģʽ£¬ÒÔMicrosoft SQL ServerΪ»ù´¡½¨Á¢ÆðÀ´µÄ´óÐÍÊý¾Ý¿âÓ¦ÓóÌÐò£¬ÏµÍ³½çÃæÓѺᢲÙ×÷¼ò±ã£¬¼ÆËã¡¢·ÖÎö¡¢¼ìË÷¹¦Äܷdz£Ç¿´ó£¬Îª±£Ö¤Å©ÒµÒøÐÐϵͳ¼°Ê±½øÐÐ×ÝÏòºÍºáÏòÒµÎñÊý¾Ý²É¼¯¡¢°´ÕÕ²»Í¬ÒªÇóÉú³ ......
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¶¼ÊÇÈÕÆÚÀàÐ͵Ä× ......
1. Ö±½ÓÔÚPL/SQL ÖÐÐÞ¸ÄÊý¾Ý
selectÓï¾äºóÃæ¼Ó‘for updata’£¬´ò¿ª½çÃæÉϵÄÐ¡Ëø£¬±à¼£¬°´¹³¹³±£´æ¡£
eg: select * from xtgldxsyncdw for update; ²éѯ½á¹û´°¿ÚµÄÐ¡Ëø¼´¿É´ò¿ª¡£
2. µ¼È˵¼³ötables
tools -->import ......
Êý¾Ý¿âÃû£ºEmployee
±íÃû£ºEmployees
uid£ºsa
pwd£ºsa
ÎÊÌâ²¹³ä£º
×îºÃÊÇÌṩSQL SERVER½Ó¿Ú·ÃÎÊÊý¾Ý¿âµÄ´úÂë
Õâ¶Î´úÂëÊÇVS.NET×Ô¶¯Éú³É£¬ÀïÃæÓÐÄÄЩÊDz»ÐèÒªµÄÄØ£¿Ó¦¸Ã°ÑÊý¾Ý¿âÁ¬½ÓµÄ´úÂë·ÅÔÚÄĸöµØ·½ÄØ£¿
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="WebApplica ......
¸ÕÅöµ½Õâ¸öÎÊÌâʱ£¬ÒÔΪÊÇÓ¦Ó÷þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷ûÁ¬Í¨£¬²éÁ˰ëÌìµÄÍøÂç½á¹ûÍøÉÏÒ»²é£¬¸úSQL Server 2005Óйأ¬ÄãÌ«ÑôµÄ£¡
¿ªÊ¼²Ëµ¥-SQLServer2005-ÅäÖù¤¾ß-SQL Server Configuration Manager-SQLserver2005ÍøÂçÅäÖÃ-MSSQLSERVERµÄÐÒé-Ë«»÷TCP/IPÐÒé
°ÑIP¸Ä³Éµ±Ç°Ê¹Óõ쬵±È»£¬¶Ë¿ÚҲҪȷ±£ ......