´ÓExcelµ¼ÈëSQL SERVERÊý¾Ý¿â
Õâ´ÎÏîÄ¿ÊÇÒ»¸ö¾·Ñ¹ÜÀíϵͳ£¬Éæ¼°µÄÊý¾Ý¿â¼Ç¼Êý³¬³öÁËÒÔǰ×ö¹ýµÄ£¬Ã¿´Î×îÉÙ¶¼Òª´ÓEXCELµ¼ÈëÊý¾Ý¿â¼¸Ç§ÉÏÍòÌõÊý¾Ý£¬µÚÒ»´ÎʹÓÃÒ»°ãµÄ·½·¨£¬Ö´ÐÐSQLÓï¾ä£¬ÔËÓÃforÑ»·Ò»ÌõÒ»ÌõµÄ²åÈë£¬ÖØ¸´Êý¾ÝҲʹÓóÌÐòÅжϣ¬ºóÀ´½»¸¶µÄʱºò³öÎÊÌâÁË£¬Ò»´Î³¬¹ýÒ»¶¨ÌõÊýµÄ¼Ç¼£¬Ö±½Óʧ°Ü£¬ÕâÃ÷ÏÔÊÇЧÂʵÄÎÊÌâ¡£´ÓÍøÂçÉÏÕÒÁËһϣ¬·¢ÏÖÁËÒ»¸ö´ÓÀ´Ã»ÓùýµÄÀàSqlBulkCopy ÕâÀïÓÐÏêϸµÄ˵Ã÷£¬ÎҾͲ»ËµÁËhttp://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqlbulkcopy(VS.80).aspx
½Ó×ÅÎÒʹÓÃÕâ¸ö·½·¨µ¼ÈëÊý¾Ý
Ê×ÏÈ´ÓEXCEL¶ÁÈ¡Êý¾Ý µ½dataset
public DataSet GetXlsContent(string SheetName, string FileName)
{
tbDataBaseModel tbdbModel = new tbDataBaseModel();
DataSet ds = new DataSet();
//string Path = File.Replace(@"\\", @"\");
//string fromFile = FileName.Substring(FileName.LastIndexOf('\\') + 1);
try
{
string ExcelCmd = "";
string olestr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + FileName + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection ODC = new OleDbConnection(olestr);
ODC.Open();
OleDbDataAdapter odda = null;
 
Ïà¹ØÎĵµ£º
Õû¸öSQLºÍAsp.net(vb.net)Ò»Æð´ò°üµÄÈ«¹ý³ÌдһÏ¡£
Ò».×¼±¸±ØÒªµÄÎļþ
1. SQL½Å±¾Îļþ£¬Éú³ÉÒÔºó°²×°¹ý³ÌÖÐÐèÒªµÄ±íºÍ´æ´¢¹ý³ÌµÈµÈ£»
Éú³ÉÖ®ºó£¬¾ÍÔÝʱ°ÑËüÃüÃûΪdb.sql(×¢Òâ´óСд)
2.LisenceFile.rtfµÄ°²×°Îļþ£¬ÒòΪÎÒµÄϵͳÊǸöÈ˵쬶øÇÒfreeµÄ£¬ËùÒÔ¾ÍûÓÐ×ö¡£Õâ¸öÒÔºóÒ²ÊÇÒªÓõ½µÄ¡£
¶þ.ÔÚ×Ô¼ºÏÖÓеÄÏîÄ¿Àïà ......
ÓÐЩ³£¼ûµÄÎÊÌâÔÚÂÛ̳Öв»¶Ï³öÏÖ£¬²»·ÁÕûÀíһϡ£
ÒÔÏÂÓï¾äÊÇÔÚSQLServer2005ÉÏʵÏֵģ¬Ò»Ð©Óï¾äÎÞ·¨ÔÚSS2000ÉÏÖ´ÐС£
ÓÐÓÃÖ¸ÊýÊÇÎÒ¸ù¾ÝÕâ¸öÎÊÌâµÄ³£¼û³Ì¶È´òµÄ·Ö£¬½ö¹©²Î¿¼¡£Êµ¼ÊÉÏ£¬µ±ÄãÓöµ½ÁËÕâ¸öÎÊÌ⣬Õâ¸öÎÊÌâÄÄÅÂÔÙÉÙ¼û£¬½â¾ö·½°¸Ò²ÊǷdz£ÓÐÓõġ£
1. Éú³ÉÈô¸ÉÐмǼ
ÓÐÓÃÖ¸Êý£º¡ï¡ï¡ï¡ï¡ï
³£¼ûµÄÎÊÌâÀàÐÍ£º¸ù ......
¡¡UNIONÖ¸ÁîµÄÄ¿µÄÊǽ«Á½¸öSQLÓï¾äµÄ½á¹ûºÏ²¢ÆðÀ´¡£´ÓÕâ¸ö½Ç¶ÈÀ´¿´£¬ ÎÒÃÇ»á²úÉúÕâÑùµÄ¸Ð¾õ£¬UNION¸úJOINËÆºõÓÐЩÐíÀàËÆ£¬ÒòΪÕâÁ½¸öÖ¸Áî¶¼¿ÉÒÔÓɶà¸ö±í¸ñÖÐߢȡ×ÊÁÏ¡£ UNIONµÄÒ»¸öÏÞÖÆÊÇÁ½¸ö SQL Óï¾äËù²úÉúµÄÀ¸Î»ÐèÒªÊÇͬÑùµÄ×ÊÁÏÖÖÀà¡£ÁíÍ⣬µ±ÎÒÃÇÓà UNIONÕâ¸öÖ¸Áîʱ£¬ÎÒÃÇÖ»»á¿´µ½²»Í¬µÄ×ÊÁÏÖµ (ÀàËÆ SELECT DISTINCT) ......
ÓйطÖÒ³ SQL µÄ×ÊÁϺܶ࣬ÓеÄʹÓô洢¹ý³Ì£¬ÓеÄʹÓÃÓαꡣ±¾È˲»Ï²»¶Ê¹ÓÃÓα꣬ÎÒ¾õµÃËüºÄ×Ê¡¢Ð§Âʵͣ»Ê¹Óô洢¹ý³ÌÊǸö²»´íµÄÑ¡Ôñ£¬ÒòΪ´æ´¢¹ý³ÌÊǾ¹ýÔ¤±àÒëµÄ£¬Ö´ÐÐЧÂʸߣ¬Ò²¸üÁé»î¡£ÏÈ¿´¿´µ¥Ìõ SQL Óï¾äµÄ·ÖÒ³ SQL °É¡£
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from tab ......
1¡¢¿ªÊ¼->³ÌÐò-->Microsoft SQL Server 2005>ÅäÖù¤¾ß->SQL Server Configuration Manager->SQL Server 2005 ÍøÂçÅäÖà ->“xxx£¨ÄúµÄÊý¾Ý¿â£©”µÄÐÒ飬ÈçÏÂͼ
½«“Named Pipes”ºÍ“TCP/IP”µÄ״̬µ÷³É“ÆôÓÔ£¬·½·¨ÊÇÔÚ“Named Pipes”ºÍ“T ......