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

ExcelÖÐÊý¾Ýµ¼Èëµ½SQL ServerÊý¾Ý¿â

using System.Data.SqlClient;
using System.Data.OleDb;
  private void tsmiImportTeacherInfo_Click(object sender, EventArgs e)
        {
            DataSet ds;
            if (ofdImport.ShowDialog()==DialogResult.OK)
            {
                ds = ImportExcel(this.ofdImport.FileName);  //»ñµÃExcel
            }
            else
            {
                return;
            }
            int odr = 0;
            SqlConnection cn = db.sqlconnection();
            try
            {
                cn.Open();
                string str = "insert into Teacher (TeacherId,Pwd,eachCourse,TeacherName) values(@TeacherId,@Pwd,@TeachCourse,@TeacherName)";
                SqlCommand cmd = db.sqlcommand(str,cn);
                int dsLength = ds.Tables[0].Rows.Count;   //»ñµÃExcelÖÐÊý¾Ý³¤¶È 
          &


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

SQLÓï¾äÓÅ»¯

£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò£¨Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ£©
oracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒÖÁ×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±í£©½«×îÏȱ»´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection table)×÷Ϊ»ù´ ......

ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û

²»ÖªµÀÕâÑùµÄÒªÇóÄܲ»ÄÜʵÏÖ£¿
±ÈÈçÎÒÓÐÒ»ÕűíT1£¬ÀïÃæÖ»ÓÐÒ»¸ö×Ö¶Î1
ÀïÃæÓÐ100Ìõ¼Ç¼£¬ÈçÏÂËùʾ£º
×Ö¶Î1
A1
A2
A3
A4
...
A100
ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û
µÚÒ»ÁР   µÚ¶þÁР   ...        µÚÊ®ÁÐ
A1        A11    &nb ......

SQl Óï¾ä(³£¼û) н¨,ɾ³ý,Ð޸ıí½á¹¹

н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [±í ......

SQLʵÏÖÍêÈ«ÅÅÁÐ×éºÏ

---SQLʵÏÖÍêÈ«ÅÅÁÐ×éºÏ
create function F_strSpit(@s varchar(200)) returns table
as
return(
select value=substring(@s,i,num)+substring(@s,num-1+j,1)
from (select num=number from spt_values where type='p' and number<len(@s) and number>0)TA,
(select i=number+1 from spt_values where type='p ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ