˵Ã÷£º 1¡¢ÒÔÏÂ×Ö·ûÖÐÊý¾Ý¿âÃûintcn£¬Êý¾Ý¿â·þÎñÆ÷ÃûWWW-20150301\SQL2005£¨»òÕß127.0.0.1£©,WWW-20150301ΪÄãµÄ·þÎñÆ÷»òÕß¼ÆËã»úÃû³Æ 2¡¢²é¿´sqlÊý¾Ý¿â·þÎñÆ÷Ãû³Æ£º¶ÔÏó×ÊÔ´¹ÜÀíÆ÷->Êý¾Ý¿â->ÓÒ¼üµã»÷×Ô¼º½¨µÄÊý¾Ý¿â->ÊôÐÔ->ȨÏÞ 3¡¢Provider=sqlncliÒ²¿ÉÒÔ,UIDÓë¡°=¡±Ö®¼ä²»¿ÉÒÔÓпոñ£¬Èç¹û»»ÓÃuser id¾Í¿ÉÒÔÓÐ ¿Õ¸ñ£¬Initial Catalog¿ÉÒÔ»»ÓÃdatabase£¬pwd¿ÉÒÔ»»ÓÃpassword£¬data source¿ÉÒÔ»»ÓÃserver£¬ ÔÚVBScriptÖУ¬²»Çø·Ö´óСд£¬Òò´ËUIDµÈͬuidµÈͬUid£¬ÆäÖÐprovider¡¢uid¡¢pwd¡¢Initial Catalog¡¢data sourceµÄλÖÿÉÒÔËæ±ã°²ÅÅ¡££¨
1£©¡¢windowsÉí·ÝÑéÖ¤Á¬½ÓSQL2005×Ö·û´®£¬Ê¹ÓÃIntegrated Security=SSPI·½·¨   ¡¯¡¯¡¯¡¯ÒÔÏÂΪ½¨Á¢connection¶ÔÏóÁ¬½ÓÊý¾Ý¿â Dim conn Set conn=Server.CreateObject("ADODB.Connection") sql="Provider=SQLoledb£»data source=WWW-20150301\SQL2005£»UID=£»PWD=£»Initial Catalog=intcn£»Integrated Security=SSPI" conn.Open sql ¡¯¡¯¡¯¡¯ÒÔÏÂΪÅжÏÊÇ·ñÁ¬½Ó If conn.state=2 Then Response.Write("ÕýÔÚÁ¬½Ó") ElseIf conn.state=1 Then Response.Write("Á¬½ÓÒѾ´ò¿ª") Else Response.Write("¶Ô²»Æð£¬ÎÞ·¨´ò¿ªÁ¬½Ó") End If 
£¨2£©¡¢SQL SERVERÓû§ÃûÉí·ÝÑéÖ¤Á¬½Ó·½·¨,´ËÀýÖÐSQLÓû§ÃûΪsa ,ÃÜÂë********   ¡¯¡¯¡¯¡¯ÒÔÏÂΪ½¨Á¢connection¶ÔÏóÁ¬½ÓÊý¾Ý¿â Dim conn Set conn=Server.CreateObject("ADODB.Connection") sql="Provider=SQLoledb£»data source=WWW-20150301\SQL2005£»UID=sa£»PWD=********£»Initial Catalog=intcn" conn.Open sql ¡¯¡¯¡¯¡¯ÒÔÏÂΪÅжÏÊÇ·ñÁ¬½Ó If conn.state=2 Then Response.Write("ÕýÔÚÁ¬½Ó") ElseIf conn.state=1 Then Response.Write("Á¬½ÓÒѾ´ò¿ª") Else Response.Write("¶Ô²»Æð£¬ÎÞ·¨´ò¿ªÁ¬½Ó") End If
£¨3£©¡¢ÒÔÉÏÁ½ÖÖ·½·¨Ò²¿ÉÒÔÓÃÒÔÏ·½Ê½   Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName,ConnStr,Conn SqlDatabaseName = "intcn" ¡¯¡¯¡¯¡¯SQLÊý¾Ý¿âÃû SqlUsername = "sa" ¡¯¡¯¡¯¡¯SQLÊý¾Ý¿âÓû§Ãû SqlPassword = "**********" ¡¯¡¯¡¯¡¯SQLÊý¾Ý¿âÓû§ÃÜÂë SqlLocalName = "WWW-20150301\SQL2005" ¡¯¡¯¡¯¡¯SQLÖ÷»úIPµØÖ·£¨·þÎñÆ÷Ãû£© ConnStr = " Password = "&SqlPassword&" user id =" & SqlUsername&" Initial Catalog ="&SqlDatabaseName&" data source ="& SqlLocalName &"Provider = sqloledb" Set conn = Server.CreateObject("ADODB.Connection") conn.open ConnStr If conn.state=2 Then Response.Write("ÕýÔÚÁ¬½Ó") ElseIf conn.state=1 Then Response.Write("Á¬½ÓÒѾ´ò¿ª") Else Response.Write("¶Ô²»Æð£¬ÎÞ·¨´ò¿ªÁ¬½Ó") End If
-
1.       ´ò¿ª¡°SQL Server ÍâΧӦÓÃÅäÖÃÆ÷¡±¡£ 2.       µã»÷¡°·þÎñºÍÁ¬½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷¡±£¬´ò¿ª·þÎñºÍÁ¬½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷¶Ô»°¿ò£¬Õ¹¿ª¡°MSSQLSERVER¡±Ïµġ°Database Engine¡±£¬È»ºóµã»÷¡°Ô¶³ÌÁ¬½Ó¡±£¬ÔòÓÒ²àÉèÖá°±¾µØÁ¬½ÓºÍÔ¶³ÌÁ¬½Ó¡±ÏÂÃæµÄ¡°Í¬Ê±Ê¹ÓÃTCP/IPºÍnamed pipes¡±ÏȻºóÓ¦ÓÃÈ·¶¨¡£ 3.       ÉèÖÃÀýÍâSQL Server¶Ë¿Ú¡£ÔÚ¡°¿ØÖÆÃæ°å¡±Öдò¿ª¡°Windows·À»ðǽ¡±£¬Ñ¡Ôñ¡°ÀýÍâÑ¡Ï¡±¡£µã»÷Ìí¼Ó¶Ë¿Ú£¬¸ø¸öÃû³Æ£¬¶Ë¿ÚSQLĬÈϵÄÊÇ1433£¬µ±È»ÄãÒ²¿ÉÒÔÔÚ¡°SQL Server Configuration Manager¡±ÖеÄÍøÂçÅäÖÃÖÐÐ޸ġ£ 4.       ÒÔWindowsÉí·Ý½øÈëSQL Server Management Studio£¬Õ¹¿ª¡°°²È«ÐÔ¡±->¡°µÇ¼Ãû¡±£¬ÓÒ¼üн¨µÇ¼Ãû£¬ÌîÈëµÇ¼Ãû£¬ÔÚ¡°³£¹æ¡±ÖУ¬Ñ¡ÔñSQL ServerÉí·ÝÑéÖ¤£¬²¢ÌîÈëÃÜÂë¡£ÔÚ¡°Óû§Ó³ÉäÖС±£¬ÎªÓû§ÔÚÏàÓ¦µÄÊý¾Ý¿âÖÐÉèÖöÔÓ¦µÄȨÏÞ£¬ÁíÍâÔÚ¡°×´Ì¬¡±ÖУ¬½«µÇ¼ÉèÖá°ÆôÓᱡ£ÕâÑù±ãн¨ÁËÒ»¸öÓÃÓÚÍøÂçµÇ¼SQL·þÎñÆ÷µÄÓû§Õ˺š£ 5.       ÔÚSQL Server Management StudioÖУ¬ÓÒ¼üµã»÷·þÎñÆ÷£¬Ñ¡ÔñÊôÐÔµ¯³ö¡°·þÎñÆ÷ÊôÐÔ¡±¶Ô»°¿ò£¬µã»÷×ó²àµÄ¡°°²È«ÐÔ¡±£¬ÔÚ¡°·þÎñÆ÷Éí·ÝÑéÖ¤¡±ÏîÖÐÑ¡Ôñ¡°SQL Server ºÍ Windows Éí·ÝÑé֤ģʽ¡±È»ºóµã»÷È·¶¨¡£ 6.       ÔÚSQL Server Configuration ManagerÖУ¬ÖØÆô¡°SQL Server£¨MSSQLSERVER£©¡±·þÎñ¡£ 7.       ÔÚSQL Server Management Studio£¬¿ÉÒÔʹÓ÷þÎñÆ÷µÄIPµØÖ·ºÍÍøÂçÓû§µÇ¼¡£ÁíÍ⣬Èç¹û¸ü¸ÄÁËSQL ServerµÄ¶Ë¿Ú£¬ÔòÔÚ´Ë´¦µÄ¡°·þÎñÆ÷Ãû³Æ¡±ÖÐÌîÈëIPºó£¬ÓöººÅ¸ô¿ª¼Ó¶Ë¿ÚºÅ£¬È磺222.195.11.219,418¡£ ****************** 1.´ò¿ªIIS¹ÜÀíÆ÷¡£ 2.Õ¹¿ª¡°±¾µØ¼ÆËã»ú¡±£¡°ÍøÕ¾¡±Ä¿Â¼£¬Ñ¡ÖС°Ä¬ÈÏÍøÕ¾¡±½Úµã£¬ÓÒ¼ü¡°ÊôÐÔ¡±£¬ÉèÖÃÖ÷Ŀ¼¡£ 3.ÓÒ¼ü¡°Ä¬ÈÏÍøÕ¾¡±Í¼±ê£¬Ñ¡Ôñ¡°Ð½¨¡±£¡°ÐéÄâĿ¼¡±ÃüÁî¡£IIS½«Æô¶¯¡°ÐéÄâĿ¼´´½¨Ïòµ¼¡±¶Ô»°¿ò°ïÖúÎÒÃÇÍê³É´´½¨ÐéÄâĿ¼µÄ²½Öè¡£ 4.µ¥»÷¶Ô»°¿òµÄ¡°ÏÂÒ»²½¡±°´Å¥ÒÔÏÔʾÐéÄâĿ¼±ðÃûÒ³£¬ÈçHelloWorld¡£±ðÃûÊÇÎÒÃÇÓÃÀ´±êʶ¸ÃĿ¼ÖеÄ×ÊÔ´µÄÃû³Æ¡£ÔÚVS.NETÖУ¬±ðÃûÊÇÓÃÀ´Ö¸¶¨ÏîĿλÖõÄÃû³Æ¡£ 5.µ¥»÷¡°ÏÂÒ»²½¡±°´Å¥£¬ÒÔÏÔʾWebÕ¾µãÄÚÈÝĿ¼ҳ¡£ÔÚ´Ë£¬ÊäÈë°üº¬´ËÍøÕ¾ÄÚÈݵÄĿ¼µÄ·¾¶¡£ 6.µ¥»÷¡°ÏÂÒ»²½¡±°´Å¥£¬´ò¿ªÐéÄâĿ¼·ÃÎÊȨÏÞÉèÖÃÒ³Ã档ѡÖС°¶ÁÈ¡¡±¸´Ñ¡¿òºÍ¡°ÔËÐнű¾¡±¸´Ñ¡¿ò¡£ 7.µ¥»÷¡°ÏÂÒ»²½¡±°´Å¥£¬ÔÙµ¥»÷¡°Íê³É¡±°´Å¥´´½¨ÐéÄâĿ¼²¢ÖÕÖ¹Ïòµ¼¡£²é¿´IIS¹ÜÀíÆ÷ÖÐÐéÄâĿ¼µÄ´´½¨½á¹û£¬¿ÉÒÔ·¢ÏÖ£¬Ä¬ÈÏÍøÕ¾ÖжàÁËÒ»¸ö³ÝÂÖ״ͼ±êµÄHelloWorld½Úµã¡£ Èç¹ûµ±Ç°»¹²»ÊdzÝÂÖ×´£¬ÓÒ¼ü½Úµã£¬´ò¿ªÊôÐÔÒ³£¬ÔÚÐéÄâĿ¼ÖеÄÓ¦ÓóÌÐòÉèÖÃÖд´½¨Ó¦ÓóÌÐòÃûΪHelloWorldµÄÓ¦ÓóÌÐò¾Í¿ÉÒÔÁË
 
|