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

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

±¾ÎÄÀ´×ÔCSDN²©¿Í£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ­»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´úÂëµ¼ÈëÒ»¸ö6Íò¶àÌõÊý¾ÝµÄsheet£¬°üÀ¨¶ÁÈ¡£¨È«²¿¶ÁÈ¡±È½ÏÂý£©ÔÚÎҵĿª·¢»·¾³ÖÐÖ»ÐèÒª10Ãë×óÓÒ£¬¶øÕæÕýµÄµ¼Èë¹ý³ÌÖ»ÐèÒª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 excelFile, string sheetName, string connectionString)
        {
 &nbs


Ïà¹ØÎĵµ£º

SQLServer»ñȡÿ×éÇ°10%µÄÊý¾Ý

sqlserver2005Óйؼü×Öntile(x)ºÍover(partition by.. order by..)×Ó¾äÅäºÏ.
±ÈÈç»ñȡÿ¸ö±íµÄÇ°10%¸ö×ֶΡ£
select id , name , colid , rn from (
select * , rn = ntile (10 )
    over (partition by id order by colorder )
from syscolumns )t where rn = 1 ......

C#½âÎöHTML

ÔÚËÑË÷ÒýÇæµÄ¿ª·¢ÖУ¬ÎÒÃÇÐèÒª¶ÔÍøÒ³µÄHtmlÄÚÈݽøÐмìË÷£¬ÄÑÃâµÄ¾ÍÐèÒª¶ÔHtml½øÐнâÎö¡£²ð·Öÿһ¸ö½Úµã²¢ÇÒ»ñÈ¡½Úµã¼äµÄÄÚÈÝ¡£´ËÎĽéÉÜÁ½ÖÖC#½âÎöHtmlµÄ·½·¨¡£
µÚÒ»ÖÖ·½·¨£º
ÓÃSystem.Net.WebClientÏÂÔØWeb Page´æµ½±¾µØÎļþ»òÕßStringÖУ¬ÓÃÕýÔò±í´ïʽÀ´·ÖÎö¡£Õâ¸ö·½·¨¿ÉÒÔÓÃÔÚWeb CrawlerµÈÐèÒª·ÖÎöºÜ¶àWeb PageµÄÓ¦ÓÃÖ ......

[ת]ʹÓÃASPµ÷ÓÃC#дµÄCOM×é¼þ

ת×Ô: http://www.cnblogs.com/rentj1/archive/2009/02/23/1396187.html
1 н¨Àà¿âMyTestDLL
2 ÓÒ»÷ÏîÄ¿“MyTestDLL”-¡·ÊôÐÔ-¡·Éú³É-¡·¹´Ñ¡“ΪCOM»¥²Ù×÷×¢²á”
3 ´ò¿ª AssemblyInfo.cs Îļþ ÐÞ¸Ä [assembly: ComVisible(true)]
4 ´ò¿ªVisual Sutdio 2008 µÄÃüÁîÌáʾÐй¤¾ßÊäÈëguidgen.exe Ñ¡ÔñD ......

×ܽáÒ»µãAccessÓëSqlserverµÄsqlµÄ²îÒì

×î½üÕûÀí³öÀ´µÄ.Èç¹û²»ÍêÈ«µÄ»°Ï£Íû´ó¼Ò²¹³ä.
ÔÚaccessÖУ¬×ª»»Îª´óдµÄsqlº¯ÊýÊÇucase£¬ÔÚsqlserverÖУ¬×ª»»Îª´óдµÄº¯ÊýÊÇupper£»ÔÚaccessÖУ¬×ª»»ÎªÐ¡Ð´µÄº¯ÊýÊÇlcase£¬ÔÚsqlserverÖУ¬×ª»»ÎªÐ¡Ð´µÄº¯ÊýÊÇlower£»ÔÚaccessÖУ¬È¡µ±Ç°Ê±¼äµÄº¯ÊýÊÇnow£¬ÁíÍ⻹ÓÐÒ»¸öÈ¡ÈÕÆÚº¯Êýdate£¬ÔÚsqlserverÖУ¬È¡µ±Ç°µÄº¯ÊýÊÇgetdate ......

SqlServer ÓαêÀý×Ó

 
Declare @Id int
Declare @Name varchar(20)
Declare Cur Cursor For Select Id,Name from T_User  
Open Cur
Fetch next from Cur Into @Id,@Name
While @@fetch_status=0    
Begin
    Update T_User Set [Name]=@Name,Id=@Id
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ