Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ADO.NETÖеÄsqlÁ¬½Ó

using System.Data;            // Use ADO.NET namespace
using System.Data.SqlClient;  
 SqlConnection thisConnection = new SqlConnection(
            @"Data Source=GY; Initial Catalog=northwind;uid=sa;password=datadog"); //ÏȽ¨Á¢Á¬½Ó
 thisConnection.Open();//´ò¿ªÁ¬½Ó
         SqlCommand thisCommand = thisConnection.CreateCommand();//Ö±½ÓÖ¸¶¨connµÄcommand
Ò²¿ÉÒÔÕâÑù        //  SqlCommand cmd = new SqlCommand();
       //  cmd.Connection = thisConnection;
cmmandµÄsqlÃüÁî         
thisCommand.CommandText = "SELECT CustomerID, CompanyName from Customer";
         SqlDataReader thisReader = thisCommand.ExecuteReader();//sqldatareader²»¿ÉÒÔÓÃnew ±ØÐëÖ±½ÓÓëcommand¹ØÁª
//ÓÃreader¶Á³ö±í
         while (thisReader.Read())
         {
            // Output ID and name columns
            Console.WriteLine("\t{0}\t{1}", 
               thisReader["CustomerID"], thisReader["CompanyName"]);
         // Close reader ÓÃÍêÒª¹Ø±Õ
         thisReader.Close();
   


Ïà¹ØÎĵµ£º

SQL Server2005 °²×°·½·¨

  µÚÒ»´Î°²×°2005,»¨Á˲»ÉÙ¾«Á¦¡£ËäȻûʲô̫Äѵģ¬µ«ÊDz»ÖªµÀµÄ»°»áºÜ¼¬Êֵġ£Èç¹ûÄãÕýÔÚ°²×°£¬²¢ÇÒ·¢ÏÖÕâƪÎÄÕ£¬ÄÇôÄãºÜ×ßÔË£¬Ä㽫»á˳ÀûµÄ°²×°³É¹¦¡£
    °²×°Ä¿Â¼Öаüº¬Sql Server x64  ºÍ x86,  x86ÊÇ32λ»úÆ÷µÄ¡£x86ÖÐÓÖÓÐtools ºÍ   Servers ¡£µÚÒ»´Î°²×°ÁËServers£¬È» ......

SQL ¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)

create PROC [dbo].[P_viewPage_A]
/*
¸ßЧͨÓ÷ÖÒ³´æ´¢¹ý³Ì(Ë«Ïò¼ìË÷)
¾´¸æ£ºÊÊÓÃÓÚµ¥Ò»Ö÷¼ü»ò´æÔÚΨһֵÁеıí»òÊÓͼ
ps:SqlÓï¾äΪ8000×Ö½Ú,µ÷ÓÃʱÇë×¢Òâ´«Èë²ÎÊý¼°sql×ܳ¤¶È²»Òª³¬¹ýÖ¸¶¨·¶Î§
*/
@TableName VARCHAR(200),     --±íÃû
@FieldList VARCHAR(2000),    --ÏÔʾÁÐà ......

SQLɾ³ýÖ¸¶¨×Ö¶ÎÎÊÌâ

¸üÐÂÏÂÎÊÌ⣺
񡜧TBL_Info
×ֶΣº
    infoId int
    title  varchar(20)
    Content  text
    byUser  varchar(20)
    createTime datetime
1¡¢ÈçºÎɾ³ý±íÖÐÊý¾ÝÏàͬµÄÊý¾ÝÄØ£¿£¨Ö÷¼ü³ýÍ⣩
2¡¢ÈçºÎɾ³ýÊý¾Ý±íÖÐij¸ö×Ö¶ÎÊý¾ÝÏàÍ ......

¡¾×ªÔØ.SQL×¢ÈëÔ­Àí¡¿SQL×¢Èë·¨¹¥»÷Ò»ÈÕͨ

Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚ³ÌÐòÔ±µÄˮƽ¼°¾­ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù
¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊý¾Ý£¬Õâ¾ÍÊÇËùνµÄS ......

¡¾×ªÔØ.SQL×¢ÈëÔ­Àí¡¿SQL×¢È멶´È«½Ó´¥ ÈëÃÅƪ

Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾­ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ