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

C#²Ù×÷SQL ServerÊý¾Ý¿â(ת)


Visual C#Öж¯Ì¬²Ù×÷SQL ServerÊý¾Ý¿â £¨1£©
 
·¢²¼Ê±¼ä£º2003.01.14 10:09     À´Ô´£ºÈüµÏÍø    ×÷ÕߣºÍõ¿­Ã÷
ÔÚ±àдÊý¾Ý¿âÓ¦ÓóÌÐòµÄʱºò£¬ÎÒÃÇ¿ÉÒÔͨ¹ýSQLÓï¾äÀ´¶¯Ì¬´´½¨¡¢ÐÞ¸ÄÊý¾Ý¿âÒÔ¼°ÆäÖеĶÔÏó¡£±¾ÎÄÎÒ¾ÍÏò´ó¼Ò½éÉÜÈçºÎÔËÓÃVisual C#À´¶¯Ì¬²Ù×÷SQL ServerÊý¾Ý¿â£¬ÆäÖаüÀ¨ÈçºÎ´´½¨Ò»¸öSQL ServerÊý¾Ý¿âÒÔ¼°ÈçºÎ´´½¨ÆäÖÐµÄ±í¡¢´æ´¢¹ý³Ì¡¢ÊÓͼ¡¢Ë÷ÒýÖ®ÀàµÄÊý¾Ý¿â¶ÔÏó¡£±¾ÎÄ»¹½éÉÜÁËÈçºÎ¶¯Ì¬µØÐ޸ıíµÄģʽ£¬ÈçºÎ´Ó±í¡¢´æ´¢¹ý³ÌÒÔ¼°ÊÓͼÖжÁÈ¡Êý¾Ý²¢ÏÔʾÔÚÓ¦ÓóÌÐòµÄÊý¾Ý¿â¿Ø¼þÖС£
ÎÒÃÇÖªµÀSQLÓï¾äÔÚ²Ù×÷Êý¾Ý¿âʱÔËÓõÃ×î¶àµÄÊÇSelect¡¢Insert¡¢UpdateºÍDeleteµÈ¶ÔÓÚÊý¾ÝµÄ²Ù×÷£¬¶ø±¾ÎÄÖصãÏò´ó¼Ò½éÉܵÄÊǶÔÓÚÊý¾Ý¿â¼°Æä¶ÔÏóµÄ²Ù×÷¡£Í¨¹ýÕÆÎÕÕâЩ»ù±¾µÄ²Ù×÷·½·¨£¬¶ÁÕ߾ͿÉÒÔ¸ü¼ÓÁé»îµØ½øÐÐÊý¾Ý¿âÓ¦ÓóÌÐòµÄ¿ª·¢¡£
 
¿ª·¢ÊµÀý¼°²½Öè
1£®½çÃæÉè¼Æ£º
±¾ÎÄÏò´ó¼Ò½éÉÜÒ»¸öÔËÓÃVisual C#¶¯Ì¬²Ù×÷Êý¾Ý¿âµÄʵÀý£¬ÊµÀýµÄ½çÃæÈçͼ1Ëùʾ¡£
 
 
ͼ1
´ÓÉÏͼ¿ÉÖª£¬ÎÒÃǵÄʵÀý³ÌÐòÖ»°üº¬ÁË10¸ö°´Å¥¿Ø¼þÒÔ¼°Ò»¸öDataGrid¿Ø¼þ¡£°´Å¥¿Ø¼þ·ÖΪÈýÀà:
µÚÒ»ÀàΪ´´½¨Êý¾Ý¿âÒÔ¼°Êý¾Ý¿â¶ÔÏóµÄ°´Å¥£»
µÚ¶þÀàΪ²é¿´²»Í¬Êý¾Ý¿â¶ÔÏóÖеÄÊý¾ÝµÄ°´Å¥£»
µÚÈýÀàÔòΪÐÞ¸ÄÊý¾Ý¿â¶ÔÏóµÄ°´Å¥¡£ÆäÖеÄDataGrid¿Ø¼þÔòÊÇÓÃÓÚÏÔʾÊý¾ÝµÄ¡£
2£®Ìí¼ÓÒýÓü°Êý¾Ý³ÉÔ±£º
Éè¼ÆÍê½çÃ棬ÎÒÃǾͿÉÒÔ¿ªÊ¼±àд³ÌÐò´úÂë¡£Ê×ÏÈÊÇΪÎÒÃǵijÌÐòÌí¼Ó±ØÒªµÄÒýÓÃÒÔ¼°Ò»Ð©Êý¾Ý³ÉÔ±¡£ÒòΪÎÒÃǵijÌÐòÉæ¼°µ½Êý¾Ý¿âµÄ·ÃÎʲÙ×÷£¬ËùÒÔ±ØÐëÒªÔËÓõ½Êý¾ÝÌṩÕߣ¨Data Provider£©µÄ¶ÔÏó¡£ÔÚ.Net¿ò¼ÜÏ£¬ÎÒÃÇÖ÷ÒªÔËÓõÄÊý¾ÝÌṩÕß·ÖΪÁ½À࣬һÀàÊÇSqlÀàÐ͵ģ¬ÁíÒ»ÀàÊÇOleDbÀàÐ͵ġ£ËüÃÇÉæ¼°µ½µÄÃüÃû¿Õ¼ä·Ö±ðΪSystem.Data.SqlClientºÍSystem.Data.OleDb¡£ÒòΪÎÒÃǵijÌÐò·ÃÎʵÄÊÇSQL ServerÊý¾Ý¿â£¬ËùÒÔÎÒÃÇÔËÓõÄÊý¾ÝÌṩÕ߶ÔÏóӦΪSqlÀàÐ͵ġ£Ô­ÒòºÜ¼òµ¥£¬¸ÃÀàÐ͵ĶÔÏóÊÇרÃÅΪSQL ServerÊý¾Ý¿â¶øÉè¼ÆµÄ£¬ËùÒÔÐÔÄܵõ½ÁË´ó´óµÄÓÅ»¯¡£ËùÒÔ£¬ÔÚÎÒÃǵijÌÐòµÄ¿ªÊ¼´¦Ìí¼ÓÈçÏÂÒ»¾äÓï¾ä£º
DE>using System.Data.SqlClient;DE>
Ìí¼Ó¶ÔSystem.Data.SqlClientÃüÃû¿Õ¼äµÄÒýÓúó£¬ÎÒÃǽÓÏÂÀ´Îª³ÌÐòÌí¼ÓһЩ±ØÒªµÄÊý¾Ý³ÉÔ±£¬ÕâЩÊý¾Ý³ÉԱΪÎÒÃǵÄÀàµÄ˽ÓгÉÔ±£¬Í¨¹ýËüÃÇÎÒÃÇ¿ÉÒÔÍê³ÉһЩ¶ÔÊý¾Ý¿â¼°Æä¶ÔÏóµÄ²Ù×÷¡£
DE>private string ConnectionString = "Integrated
Security=SSPI;Initial Catalog=;Data Source=localho


Ïà¹ØÎĵµ£º

SQL SERVER¿ì½Ý¼ü

                                                   ......

ÓÃASP.NET/C#Á¬½ÓAccessºÍSQL ServerÊý¾Ý¿â

Á¬½ÓAccess
Ê×ÏÈ¿´Ò»¸öÀý×Ó´úÂëƬ¶Ï:
³ÌÐò´úÂë:
--------------------------------------------------------------------------------
using System.Data;
using System.Data.OleDb;
......
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:\BegASPNET\Northwind.mdb" ......

Win7Ï°²×°SQL Server2005

ÔÚWin7Ï°²×°SQL2005¿ª·¢°æ£¬°²×°SQL Native ClientʱÌáʾ°²×°Öжϣ¬Ã»ÓÐÔÚÒ⣬ȻºóÔÚ°²×°SQL ServerʱÓÖÌáʾ“[Microsoft][SQL Native Client]¿Í»§¶Ë²»Ö§³Ö¼ÓÃÜ.SQL Server °²×°³ÌÐòÎÞ·¨Á¬½Óµ½Êý¾Ý¿â·þÎñ½øÐзþÎñÆ÷ÅäÖÃ.”жÔØSQL Native ClientÖØа²×°£¬»¹ÊÇÖжϣ¬ÐÞ¸´£¬Ò²Öжϣ¬ÔÙжÔØ£¬ÇåÀí×¢²á±í£¬ÖØ× ......

ÊÖ°ÑÊÖ½ÌÄãC#¶ÁÈ¡XMLÎļþ

C#¶ÁÈ¡XML×ÊÁÏ
Ò» C#¶ÁÈ¡XML×ÊÁÏ
À©³ä±ê¼ÇÓïÑÔXML£¨eXtensible Markup Language£©£¬ÊÇÓÉWÈýC»ú¹ØÖƶ©µÄ¡£×öΪÓÃÒÔ´úÌæHTMLÓïÑÔµÄÒ»ÖÖÐÂʽµÄ±ê¼ÇÓïÑÔ£¬XMLÄÚ²¿ÓÐןܶà¸ù±¾»ù×¼£¬XMLÄËÊǾ­¹ýÓëÕâЩÏà¸É»ù×¼µØ×éºÏ£¬Ó¦ÓÃÓÚ¿Æѧ¼ÆËã¡¢µç×Ó³ö°æ¡¢¶àýÌåϵÌåÀý×÷ºÍµç×ÓÉÌÎñµÄ¡£C££×÷ΪһÖÖÐÂʽµÄ³ÌÐòÓïÑÔ£¬ÊÇ.Net¹¹¼ÜµÄÒ»¸öÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ