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

ÈçºÎ¸ßЧµÄ½«excelµ¼Èësqlserver£¿


¡¡¡¡´ó²¿·ÖÈ˶¼ÖªµÀÓÃoledbÀ´¶ÁÈ¡Êý¾Ýµ½dataset£¬µ«ÊǶÁÈ¡Ö®ºóÔõô´¦Àídataset¾ÍǧÆæ°Ù¹ÖÁË¡£ºÜ¶àÈËͨ¹ýÑ­»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬System.Data.SqlClient.SqlBulkCopy ¶ÔÓÚÐÂÊÖÀ´Ëµ»¹ÊDZȽÏÄ°ÉúµÄ£¬Õâ¸ö¾ÍÊÇ´«ËµÖÐЧÂʼ«¸ßµÄbcp£¬6Íò¶àÊý¾Ý´Óexcelµ¼Èëµ½sqlÖ»ÐèÒª4.5Ãë¡£
using System;
using System.Data;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //²âÊÔ£¬½«excelÖеÄsheet1µ¼Èëµ½sqlserverÖÐ
            string connString = "server=localhost;uid=sa;pwd=sqlgis;database=master";
            System.Windows.Forms.OpenFileDialog fd = new OpenFileDialog();
            if (fd.ShowDialog() == DialogResult.OK)
            {
                TransferData(fd.FileName, "sheet1", connString);
            }
        }
        public void TransferData(string e


Ïà¹ØÎĵµ£º

MyEclipseÖÐÅäÖÃSQLServer 2005Êý¾Ý¿â

1.°²×°ºÃSQLServer 2005Êý¾Ý¿âÈí¼þ£¬½Ó×Å×îÖØÒªµÄ¾ÍÊÇ°²×°Êý¾Ý¿âÇý¶¯SQL Server 2005 driver for JDBC£¬¿ÉÒÔµ½:http://download.microsoft.com/download/8/B/D/8BDABAE2-B6EA-41D4-B903-7916EF3690EF/sqljdbc_1.2.2323.101_enu.exeÏÂÔØ
2.½«JDBC½âѹµ½ÈÎÒâµÄλÖã¬ÔÚ°²×°Ä¿Â¼ÀïÕÒµ½sqljdbc.jarÎļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ­½²¹ý» ......

SQLSERVER¾Û¼¯Ë÷ÒýÓë·Ç¾Û¼¯Ë÷Òý£¨×ª£©

΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
ʵ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´ ......

c#ÖиßЧµÄexcelµ¼ÈësqlserverµÄ·½·¨

±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
    ½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ­»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......

SQLserverʱ¼ä¶Î²éѯ

eg:
select * from Exception_Log where DATEDIFF(day,OPER_DATE,getdate())<30 ;
/*
oper_date Ϊ±íÖвéѯ³öÀ´µÄʱ¼ä
getdate()ΪSQLServerÀïÃæ»ñµÃϵͳʱ¼äµÄº¯Êý
º¬Ò壺µ±Ç°Ê±¼ä-²éѯ³öÀ´µÄʱ¼äСÓÚ30Ìì
DateDiff¾ßÌåÓ÷¨£º
*/
DateDiff º¯Êý
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£
DateDiff(interval, date1, da ......

SQLServer³£¼û²éѯÎÊÌâ

ÓÐЩ³£¼ûµÄÎÊÌâÔÚÂÛ̳Öв»¶Ï³öÏÖ£¬²»·ÁÕûÀíһϡ£
ÒÔÏÂÓï¾äÊÇÔÚSQLServer2005ÉÏʵÏֵģ¬Ò»Ð©Óï¾äÎÞ·¨ÔÚSS2000ÉÏÖ´ÐС£
ÓÐÓÃÖ¸ÊýÊÇÎÒ¸ù¾ÝÕâ¸öÎÊÌâµÄ³£¼û³Ì¶È´òµÄ·Ö£¬½ö¹©²Î¿¼¡£Êµ¼ÊÉÏ£¬µ±ÄãÓöµ½ÁËÕâ¸öÎÊÌ⣬Õâ¸öÎÊÌâÄÄÅÂÔÙÉÙ¼û£¬½â¾ö·½°¸Ò²ÊǷdz£ÓÐÓõġ£
1. Éú³ÉÈô¸ÉÐмǼ
ÓÐÓÃÖ¸Êý£º¡ï¡ï¡ï¡ï¡ï
³£¼ûµÄÎÊÌâÀàÐÍ£º¸ù¾Ý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ