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

ʹÓÃasp.net 2.0ÖеÄSqlBulkCopyÀàÅúÁ¿¸´ÖÆÊý¾Ý

½éÉÜ£º
ÔÚÈí¼þ¿ª·¢ÖУ¬°ÑÊý¾Ý´ÓÒ»¸öµØ·½¸´ÖƵ½ÁíÒ»¸öµØ·½ÊÇÒ»¸öÆÕ±éµÄÓ¦ÓᣠÔںܶ಻ͬµÄ³¡ºÏ¶¼»áÖ´ÐÐÕâ¸ö²Ù×÷£¬°üÀ¨¾Éϵͳµ½ÐÂϵͳµÄÒÆÖ²£¬´Ó²»Í¬µÄÊý¾Ý¿â±¸·ÝÊý¾ÝºÍÊÕ¼¯Êý¾Ý¡£ ASP.NET 2.0ÓÐÒ»¸öSqlBulkCopyÀ࣬Ëü¿ÉÒÔ°ïÖúÄã´Ó²»Í¬µÄÊý¾ÝÔ´¸´ÖÆÊý¾Ýµ½SQL SERVERÊý¾Ý¿â¡£ ±¾ÎÄÖÐÎÒ½«Ê¾·¶SqlBulkCopyÀàµÄ²»Í¬Ó¦Óá£
Êý¾Ý¿âÉè¼Æ£º
Õâ¸öÊý¾Ý¿âµÄÉè¼Æ»¹ÊÇÂù¼òµ¥µÄ£¬Ëü»ùÓÚNorthwindÊý¾Ý¿âµÄProducts±í¡£ÁíÍâÎÒ»¹ÔÚNorthwindÊý¾Ý¿âÖд´½¨ÁË3¸ö±í¡£ ÏêÇé¿ÉÒÔ¿´Ò»ÏÂÏÂÃæµÄÊý¾Ý¿â¹Øϵͼ¡£
Products_Archive ºÍProducts_LatestÓÐÓëProducts±íÏàͬµÄ½á¹¹£¬¶øProducts_TopSelling±íÔòÓëËüÃDz»Í¬¡£ ÉÔºóÎÒ½«ÔÚ±¾ÎĽâÊÍProducts_TopSelling±íµÄÓÃ;¡£
Products_Archive±í°üº¬770,000ÐС£ Äã²»ÓùÜÕâЩÊý¾ÝÊÇÈçºÎµÃµ½µÄ£¬ÄãÖ»ÐèÒª¿¼ÂÇÈçºÎ°ÑËùÓÐÕâЩÊý¾Ý¸´ÖƵ½Products_Latest±íÀï¡£
´ÓProducts_Archive±í ¸´ÖÆÊý¾Ýµ½ Products_Latest±í£º
SqlBulkCopy °üº¬Ò»¸ö·½·¨ WriteToServer£¬ËüÓÃÀ´´ÓÊý¾ÝµÄÔ´¸´ÖÆÊý¾Ýµ½Êý¾ÝµÄÄ¿µÄµØ¡£ WriteToServer·½·¨¿ÉÒÔ´¦ÀíµÄÊý¾ÝÀàÐÍÓÐDataRow[]Êý×飬DataTable ºÍ DataReader¡£ Äã¿ÉÒÔ¸ù¾Ý²»Í¬µÄÇéÐÎʹÓò»Í¬µÄÊý¾ÝÀàÐÍ£¬µ«ÊǸü¶àʱºòÑ¡ÔñDataReaderÊÇÒ»¸ö±È½ÏºÃµÄÖ÷Òâ¡£ ÕâÊÇÒòΪDataReaderÊÇÒ»¸öÖ»ÏòÇ°µÄ¡¢Ö»¶ÁµÄÊý¾ÝÁ÷£¬Ëü²»»á±£´æÊý¾Ý£¬ËùÒÔÒª±ÈDataTable ºÍ DataRows[]¶¼Òª¿ì¡£ ÏÂÃæµÄ´úÂëµÄ×÷ÓÃÊÇ°ÑÊý¾Ý´ÓÔ´±í¸´ÖƵ½Ä¿µÄ±í¡£
private static void PerformBulkCopy()
{
string connectionString = @"Server=localhost;Database=Northwind;Trusted_Connection=true";

// Ô´
using (SqlConnection sourceConnection = new SqlConnection(connectionString))
{
SqlCommand myCommand = new SqlCommand("SELECT * from Products_Archive", sourceConnection);
sourceConnection.Open();
SqlDataReader reader = myCommand.ExecuteReader();

// Ä¿µÄ
using (SqlConnection destinationConnection = new SqlConnection(connectionString))
{
// ´ò¿ªÁ¬½Ó
destinationConnection.Open();

using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection.ConnectionString))
{
bulkCopy.BatchSize = 500;
bulkCopy.NotifyAfter = 1000;
bulkCo


Ïà¹ØÎĵµ£º

ASP.NETÖÐÐÎʽµÄÓ÷¨

½ñÌìµÚÒ»Ì쿪ͨÁ˲©¿Í£¬ÐÄÇéÀÖ×Ì×̵ģ¬ÒòΪ¿ÉÒÔºÍÔ°×ÓÀïµÄÅóÓÑÒ»ÆðÑо¿¼¼ÊõÁË¡£ÎÒÏ£Íû°ÑƽʱÔÚÏîÄ¿ÖлýÀÛµÄ֪ʶÒÔ¼°×Ô¼ºÑ§Ï°µÄ֪ʶͬ԰×ÓÀïµÄÅóÓÑ·ÖÏí·ÖÏí¡£ÎªÎÒÃÇÔ°×ÓµÄ׳´ó¸¶³ö×Ô¼ºµÄÒ»µãŬÁ¦¡£ÕâÊÇÎÒ·¢±íµÄµÚ¶þƪ»°Ì⣬ϣÍû¶ÔÕâ<%%>Óï·¨²»ÊìϤµÄÅóÓÑÌṩ°ïÖú£¬¶ÔÒѾ­ÊìϤµÄÅóÓÑ£¬Ï£ÍûÄÜÌá³öÄãÃDZ¦¹óµÄÒâ¼û¡£
ÔÚa ......

asp.netÉú³É¾²Ì¬Ò³Ãæ

public static void GetHtml(string url,string savepath)//url²ÎÊýΪ½«ÒªÉú³ÉµÄÄǸö¶¯Ì¬Ò³ÃæµÄµØÖ·£¬savepathΪҪ´æ·ÅµØÖ·
{
string Result;
WebResponse MyResponse;
WebRequest MyRequest = System.Net.HttpWebRequest.Create(url);
MyResponse = MyReque ......

ASP.NETÒ³Ãæ¼äµÄ´«ÖµµÄ¼¸ÖÖ·½·¨£¨×ªÔØ£©

ASP.NETÒ³Ãæ¼äµÄ´«ÖµµÄ¼¸ÖÖ·½·¨£¨×ªÔØ£©
 ASP.NET¡¡WEB¡¡FORMS¡¡¡¡¸ø¿ª·¢ÕßÌṩÁ˼«ºÃµÄʼþÇý¶¯¿ª·¢Ä£Ê½¡£È»¶øÕâÖÖ¼òµ¥µÄÓ¦ÓóÌÐò¿ª·¢Ä£Ê½È´¸øÎÒÃÇ´øÀ´ÁËһЩСÎÊÌ⣬¾Ù¸öÀý×Ó£¬ÔÚ´«Í³µÄASPÓ¦ÓóÌÐòÖУ¬ÄãÄܹ»Í¨¹ýPOST·½·¨ºÜÈÝÒ׵İÑÒ»¸öÖµ»ò¶à¸öÖµ´ÓÒ»¸öÒ³Ãæ´«Ë͵½ÁíÒ»¸öÒ³Ã棬ÓÃͬÑùµÄ·½·¨ÔÚASP.NETÖÐʵÏÖÓеãÂé·³ ......

asp.netÖÐ×öÊÓƵת»»£¬½«¸÷ÖÖÊÓƵÎļþת»»³É.flv¸ñʽ

asp.netÖÐ×öÊÓƵת»»£¬½«¸÷ÖÖÊÓƵÎļþת»»³É.flv¸ñʽ ×öÒ»¸öÊÓƵת»»µÄDemo,ÏÖÔÚ³öÏֺܵÄÍøÉÏÔÚÏßÊÓƵÆäÎļþ¸ñʽ¶¼ÊÇ.FLV¸ñʽ£¬ÄÇЩÊÓƵÍøÕ¾´ó¸ÅÒ²ÓÐÒ»¸öÊÓƵת»»Èí¼þ£¬ËùÎÒÔÚÒ²ÊÔ×ÅÈ¥×öÁËÒ»¸ödemoÄóöÀ´ºÍ´ó¼Ò¹²Ïíһϣ¬ÓÉÓÚ×Ô¼ºµÄ¼¼ÊõÓÐÏÞ£¬×öµÄ²»ÔõôÑù£¬Ô¸ÓиßÈË¿´Íê¸ø
ÔÚÏÂÖ¸µãÒ»¶þ. ºÇ....¡¡·Ñ»°²»¶à˵ÁË£¬ÏÂÃæÀ´·Ö½ ......

asp.net Ôö¼Ó²¥·Å¿Ø¼þ&²¥·ÅÊÓƵÎļþ

asp.net Ôö¼Ó²¥·Å¿Ø¼þ&²¥·ÅÊÓƵÎļþ2009-11-02 13:59/// <summary>//°ó¶¨ÊÓƵ²¥·Å
    /// °ó¶¨ÊÓƵ²¥·Å
    /// </summary>
    /// <param name="width">²¥·ÅÆ÷¿í¶È</param>
    /// <param name="height">²¥·ÅÆ÷¸ß¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ