Excelµ¼ÈëSQL£¨2£©
ÓõÚÒ»ÖÖ·½·¨£¬ÉÏ´«·þÎñÆ÷ºó£¬ÔÚһЩ·þÎñÆ÷ÖУ¬¿ÉÄÜ»á³öÏÖÒÔÏ´íÎó£º
±ØÐëÔÚweb.configÖÐ¼Ó <system.web><identity impersonate="false"/></system.web> ,·ñÔò³öÏÖ´íÎó£ºSystem.Data.OleDb.OleDbException: δָ¶¨µÄ´íÎó¡£¼ÓÁËÒԺ󣬵ã¶à¼¸´ÎÁ´½Ó£¬»á³öÏÖ“Óû§ 'NT AUTHORITY\NETWORK SERVICE' µÇ¼ʧ°Ü”£¬ÐèÒªÖØÐÂÉÏ´«£¬È»ºóÓÖ³öÏÖͬÑùµÄ´íÎó¡£
ËùÒÔ£¬Èç¹ûÒªÉÏ´«µ½·þÎñÆ÷µÄ»°£¬¾ÍÒªÓõ½µÚ¶þÖÖ·½·¨¡£ÈçÏ£º
public Random rd;
rd = new Random(1);
string filename = this.FileUpload1.PostedFile.FileName;
//string filename = this.FileUpload1.PostedFile.FileName;
string type = filename.Substring(filename.LastIndexOf("."));
string z = Server.MapPath("../file/") + Guid.NewGuid().ToString() + type;
this.FileUpload1.PostedFile.SaveAs(z);
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionString ["IEISConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SELECT * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=Yes;IMEX=1;DATABASE=" + z + "',sheet1$)";
SqlDataAdapter da = new SqlDataAdapter();
Ïà¹ØÎĵµ£º
1. GROUP BY ÊÇ·Ö×é²éѯ, Ò»°ã GROUP BY ÊǺ;ۺϺ¯ÊýÅäºÏʹÓÃ
group by ÓÐÒ»¸öÔÔò,¾ÍÊÇ select ºóÃæµÄËùÓÐÁÐÖÐ,ûÓÐʹÓþۺϺ¯ÊýµÄÁÐ,±ØÐë³öÏÖÔÚ group by ºóÃ棨ÖØÒª£©
ÀýÈç,ÓÐÈçÏÂÊý¾Ý¿â±í£º
A B
1 abc
1 bcd
1 asdfg
Èç¹ûÓÐÈ ......
--·Ö½â×Ö·û´®°üº¬µÄÐÅÏ¢ÖµºóÈ»ºóºÏ²¢µ½ÁíÍâÒ»±íµÄÐÅÏ¢
--(°®Ð¾õÂÞ.ع»ª(Ê®°ËÄê·çÓê,ÊصñùɽѩÁ«»¨¿ª) 2007-12-23 ¹ã¶«ÉîÛÚ)
/*ÎÊÌâÃèÊö
tba
ID classid name
1 1,2,3 Î÷·þ
2 2,3 ÖÐɽװ
3&n ......
SELECT LEFT(RTRIM('20080927p1058'),LEN('20080927p1058')-2)
SELECT SUBSTRING('20080927p1058',1,LEN('20080927p1058')-2)
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*whit ......
SQL Server 2005µÄжÔØÊÇÒ»¸ö·Ç³£Í·ÌÛµÄÎÊÌâ¡£ÎÒÔø¾³¢ÊÔ¹ýÖ±½ÓʹÓá¾Ìí¼Ó»òɾ³ý³ÌÐò¡¿¹¤¾ßжÔØ¡¢Çå³ý°²×°Ä¿Â¼¡¢É¾³ý×¢²á±íÄÚÈݵȵȸ÷ÖÖ·½Ê½×ÛºÏжÔØ£¬ÃãÇ¿³É¹¦¡£ÏÖÔÚÖÕÓÚÕÒµ½ÁËÒ»¸öÊ°빦±¶µÄ·½·¨£¬¶à´Î³¢ÊÔ£¬Î´ÓÐʧ°Ü,¾ßÌåÈçÏÂ:
1.ÏÂÔØжÔع¤¾ß£¬ÓÐÁ½ÖÖ£º
µÚÒ»ÖÖÊÇ΢Èí¹Ù·½ÌṩµÄ¹¤¾ß(msicuu2.exe)
http://support.mic ......
¡¾»ã×Ü¡¿SQL CODE --- ¾µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾µä¶ÌС´úÂëÊÕ¼¯
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í 50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.spt_val ......