sql²Ù×÷
ÅжÏÁ¬½ÓÊý¾Ý¿â״̬£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace= "System.Data.SqlClient" %>
<mce:script runat = "server"><!--
protected void Page_Load(object sender, EventArgs e)
{
var cn = new SqlConnection();
cn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|product_Data.MDF;Integrated Security=True;User Instance= True";
cn.Open();
if (cn.State == System.Data.ConnectionState.Open)
{
Response.Write("SQLÁ¬½Ó¿ªÆô");
cn.Close();
}
if (cn.State == System.Data.ConnectionState.Closed)
{
Response.Write("SQLÁ¬½Ó¹Ø±Õ");
}
}
// --></mce:script>
Ö´ÐвåÈëSqlÓï¾ä£¬´úÂëÈçÏ£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace= "System.Data.SqlClient" %>
<mce:script runat = "server"><!--
protected void Page_Load(object sender, EventArgs e)
{
var cn = new SqlConnection();
cn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|product_Data.MDF;Integrated Security=True;User Instance= True";
var cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "INSERT Produce(ProductID,ProductName,Price) VALUES(155,'apple',125)";
cn.Open();
var records = cmd.ExecuteNonQuery();
cn.Close();
Response.Write("ÐÂÔöÁË"+records.ToString()+"ÌõÊý¾Ý");
}
// --></mce:script>
¸üÐÂÊý¾Ý¿âÓï¾ä£º
<%@ Pa
Ïà¹ØÎĵµ£º
Òª»ñµÃÕýÔÚÔËÐеÄSQL Server 2005µÄ°æ±¾ºÅ£¬¿Éͨ¹ýSQL Server Management StudioÁ¬½Óµ½¸Ã·þÎñÆ÷£¬È»ºóÔËÐÐÒÔÏÂSQLÓï¾ä£º
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
Ðк󣬿ɵõ½ÐèÒªµÄ°æ±¾ÐÅÏ¢£¬ÀýÈçÔÚÎҵĻúÆ÷ÉÏÔËÐкóµÃµ ......
ÔÖ· http://technet.microsoft.com/ja-jp/library/cc411406.aspx
¿´ÁËһƪSQL2005¹ØÓÚTransact-SQLµÄÇ¿»¯¼¼ÄܵĽéÉÜ£¬¾õµÃºÜÓÐÓô¦£¬¼òµ¥×ܽáÁËһϡ£
£¨Ò»£©Êý¾Ý¿â×ö³É
USE tempdb – »òÕßн¨Ò»¸öDB
CREATE TABLE SpeakerStats
(
speaker &n ......
·þÎñÆ÷¼¶±ð½ÇÉ«
Ϊ±ãÓÚ¹ÜÀí·þÎñÆ÷ÉϵÄȨÏÞ£¬SQL Server ÌṩÁËÈô¸É“½ÇÉ«”£¬ÕâЩ½ÇÉ«ÊÇÓÃÓÚ·Ö×éÆäËûÖ÷ÌåµÄ°²È«Ö÷Ìå¡£“½ÇÉ«”ÀàËÆÓÚ Microsoft Windows ²Ù×÷ϵͳÖеē×锡£
·þÎñÆ÷¼¶½ÇÉ«Ò²³ÆΪ“¹Ì¶¨·þÎñÆ÷½ÇÉ«”£¬ÒòΪÄú²»ÄÜ´´½¨ÐµķþÎñÆ÷¼¶½ÇÉ«¡£·þÎñÆ÷¼¶½ÇÉ«µÄȨÏÞ×÷Óà ......
ÔÚETL¹ý³ÌÖУ¬¾³£»áÅöµ½È¡½á¹û¼¯µÄ×îºó»ò×îÇ°Ò»Ìõ¼Ç¼¡£ÈçÈ¡»îÆÚ´æ¿îµÄµ±Ç°ÀûÂÊ£¬¿ª»§½ð¶î£¬Ð¶¨ÀûÂʵȡ£Èç¹û²»ÓÃLOOKUPµÄ·½Ê½£¬Èçͨ¹ýÓαêÈ¡»òÕßETL¹¤¾ßLOOKUP×é¼þʲôµÄ£¬ÔÚÒ»ÌõSQLÀïʵÏÖ£¬Ä¿Ç°ÊµÏÖÓм¸ÖÖ·½·¨¡£
1.ÒÔʱ¼ä»òÆäËû×ֶηÖ×éºóÔÚ×ÔÁ¬×Ô¼º£¬ÕâÑù²»½ö¿ÉÒÔ´ø³öÐèÒªLOOKUPµÄ×ֶΣ¬»¹¿ÉÒÔ´ø³öÆäËûÐèÒªµÄ×Ö ......
ËùνÌìÏ´óÊ£¬·Ö¾Ã±ØºÏ£¬ºÏ¾Ã±Ø·Ö£¬¶ÔÓÚ·ÖÇø±í¶øÑÔÒ²Ò»Ñù¡£Ç°ÃæÎÒÃǽéÉܹýÈçºÎɾ³ý£¨ºÏ²¢£©·ÖÇø±íÖеÄÒ»¸ö·ÖÇø£¬ÏÂÃæÎÒÃǽéÉÜÒ»ÏÂÈçºÎΪ·ÖÇø±íÌí¼ÓÒ»¸ö·ÖÇø¡£
Ϊ·ÖÇø±íÌí¼ÓÒ»¸ö·ÖÇø£¬ÕâÖÖÇé¿öÊÇʱ³£»á
·¢ÉúµÄ¡£±ÈÈ磬×î³õÔÚÊý¾Ý¿âÉè¼Æʱ£¬Ö»Ô¤¼ÆÁË´æ·Å3ÄêµÄÊý¾Ý£¬¿ÉÊǵ½Á˵Ú4ÌìÔõ ......