Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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);  
            }  
        }  
 
   


Ïà¹ØÎĵµ£º

´¥·¢Æ÷µÄ´´½¨¼°Ê¹ÓÃ(sqlserver 2005)

´¥·¢Æ÷µÄ´´½¨¼°Ê¹ÓÃ(sqlserver 2005)
´´½¨ DML »ò DDL ´¥·¢Æ÷¡£´¥·¢Æ÷ÊÇÊý¾Ý¿â·þÎñÆ÷Öз¢Éúʼþʱ×Ô¶¯Ö´ÐеÄÌØÖÖ´æ´¢¹ý³Ì¡£Èç¹ûÓû§ÒªÍ¨¹ýÊý¾Ý²Ù×÷ÓïÑÔ (DML) ʼþ±à¼­Êý¾Ý£¬ÔòÖ´ÐÐ DML ´¥·¢Æ÷¡£DML ʼþÊÇÕë¶Ô±í»òÊÓͼµÄ INSERT¡¢UPDATE »ò DELETE Óï¾ä¡£DDL ´¥·¢Æ÷ÓÃÓÚÏìÓ¦¸÷ÖÖÊý¾Ý¶¨ÒåÓïÑÔ (DDL) ʼþ¡£ÕâЩÖ÷ÒªÊÇ CRE ......

´æ´¢¹ý³ÌµÄ´´½¨¼°Ê¹ÓÃ(sqlserver 2005)

´æ´¢¹ý³ÌµÄ´´½¨¼°Ê¹ÓÃ(sqlserver 2005)
´´½¨´æ´¢¹ý³Ì¡£´æ´¢¹ý³ÌÊÇÒѱ£´æµÄ Transact-SQL Óï¾ä¼¯ºÏ£¬»ò¶Ô Microsoft .NET Framework ¹«¹²ÓïÑÔÔËÐÐʱ (CLR) ·½·¨µÄÒýÓ㬿ɽÓÊÕ²¢·µ»ØÓû§ÌṩµÄ²ÎÊý¡£¿ÉÒÔ´´½¨¹ý³Ì¹©ÓÀ¾ÃʹÓ㬻òÔÚÒ»¸ö»á»°£¨¾Ö²¿ÁÙʱ¹ý³Ì£©ÖÐÁÙʱʹÓ㬻òÔÚËùÓлỰ£¨È«¾ÖÁÙʱ¹ý³Ì£©ÖÐÁÙʱʹÓá£
Æô¶¯ SQL ......

MS SqlserverÊÓͼÇÉÓÃ

 1¡¢´´½¨Êý¾Ý¿âtestdb
 2¡¢´´½¨±ítest
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[test](
 [id] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
 [name] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
 [sex] [bit] NULL
) ON [PRIMARY]
3¡¢´´½¨Êý¾Ý¿âdb ......

ʹÓÃSqlserverÊÂÎñ·¢²¼ÊµÏÖÊý¾Ýͬ²½

      ÊÂÎñµÄ¹¦ÄÜÔÚsqlserverÖÐÓÉÀ´ÒѾã¬ÒòΪ×î½üÔÚ×öÒ»¸öÊý¾Ýͬ²½·½°¸£¬ËùÒÔÓлú»áÔÙ´ÎÑо¿Ò»ÏÂËüÒÔ¼°¿ìÕյȣ¬·¢ÏÖ»¹ÊÇÓкܶ಻´íµÄ¹¦Äܺ͸ĽøµÄ¡£ÕâÀïÒÔsqlserver2008µÄÊÂÎñ·¢²¼¹¦ÄÜΪÀý£¬¶Ô·¢²¼¶©Ôĵķ½Ê½¼òÒª½éÉÜһϲÙ×÷Á÷³Ì£¬Ò»·½Ãæ×ö¸ö×ܽᱸ·Ý£¬Ò»·½ÃæÓë´ó¼Ò½øÐÐһϷÖÏíºÍ½»Á÷¡£·Ñ»°¾Í² ......

sqlserver ÉÏ»úÁ·Ï°Ìâ

 create database db
use db
go
create table course
(
 sno varchar(20),
 cno int ,
 Gmark int
)
insert into course values('20071513115',1,80)
insert into course values('20071513114',2,80)
insert into course values('20071513113',3,80)
insert into course values('20071513 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ