C#Ò»´ÎÁ¬½ÓÊý¾Ý¿âÖ´ÐжàÌõsqlÓï¾ä(ÈýÖÖ·½·¨)
µÚÒ»ÖÖ·½·¨:
string str="server=.;uid=sa;pwd=111111;database=text_db";//Á¬½Ó×Ö·û´®
SqlConnection SCON = null;//Á¬½Ó¶ÔÏó
SqlCommand SCom=new SqlCommand();//ÃüÁî¶ÔÏó
SCON=new SqlConnection(str);
SCON.Open();
SCom.CommandText = "insert into cum(nm,age,sex,addr) values(‘”+name1+”’, ‘”+age1+”’, ‘”+sex1”’,’”+addr1+”’); insert into cum(nm,age,sex,addr) values(‘”+name1+”’, ‘”+age1+”’, ‘”+sex1”’,’”+addr1+”’)";
SCom.Connection = SCON;
SCom.CommandType = CommandType.Text;
int num = SCom.ExecuteNonQuery();
SCON.Close();
×¢Ò⣺Õâ¾ÍÊÇÓ÷ֺŸô¿ª£¬°Ñ¶àÌõsqlÓï¾äд³ÉÁËÒ»ÌõsqlÓï¾äÀ´Ö´ÐУ¬ÒòΪûÓÐÓòÎÊý£¬¿ÉÄÜÓÐsql×¢Èë·çÏÕ¡£
µÚ¶þÖÖ·½·¨:
string str="server=.;uid=sa;pwd=111111;database=text_db";//Á¬½Ó×Ö·û´®
SqlConnection SCON;
SqlCommand SCom1=new SqlCommand();//ÒªÖ´ÐÐsqlÓï¾äµÄµÚÒ»¸öÃüÁî¶ÔÏó
SqlCommand SCom2=new SqlCommand();//Ò
Ïà¹ØÎĵµ£º
MSSQL»¹ÔÊý¾Ý¿âʧ°Ü£¬ÌáʾÈçÏ£º »¹Ô¶ÔÓë·þÎñÆ÷ ʧ°Ü¡£(Microsoft.SqlServer.Smo) ÆäËüÐÅÏ¢£º ©§ ©»¡úÖ´ÐÐTransact-SQLÓï¾ä»òÅú´¦Àíʱ·¢ÉúÒì³£¡££¨Microsoft.SqlServer.ConnectionsInfo£© ©§ ©»¡ú²»ÄÜÑ¡ÔñÎļþ»òÎļþ×é¡°¡¡¡±ÓÃÓڴ˲Ù×÷¡£ RESTORE DATABASE ÕýÔÚÒì³£ÖÕÖ¹¡££¨Microsoft SQL Server, ´íÎó£º3219£© ³öÏÖ´Ë ......
Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GE ......
ÔÎÄת×Ô:http://tech.it168.com/a2009/0218/265/000000265868.shtml
Ë÷ÒýÊÇÒÔ±íÁÐΪ»ù´¡µÄÊý¾Ý¿â¶ÔÏó¡£Ë÷ÒýÖб£´æ×űíÖÐÅÅÐòµÄË÷ÒýÁУ¬²¢ÇҼͼÁËË÷ÒýÁÐÔÚÊý¾Ý¿â±íÖеÄÎïÀí´æ´¢Î»Öã¬ÊµÏÖÁ˱íÖÐÊý¾ÝµÄÂß¼ÅÅÐò¡£Í¨¹ýË÷Òý£¬¿ÉÒÔ¼Ó¿ìÊý¾ÝµÄ²éѯËٶȺͼõÉÙϵͳµÄÏìӦʱ¼ä;¿ÉÒÔʹ±íºÍ±íÖ®¼äµÄÁ¬½ÓËٶȼӿ졣
µ«ÊÇ£¬ ......
¿´ÁËһƪ½²×ù£¬Ëµµ½Êý¾Ý²ã·ÖÒ³¼¼Êõ£¬Óõ½ÁË4Öз½Ê½£¬1£©Ê¹ÓÃtop *top 2)ʹÓñí±äÁ¿ 3£©Ê¹ÓÃÁÙʱ±í 4£©Ê¹ÓÃROW_NUMBERº¯Êý¡£
ÆäÖÐ×î¿ìµÄÊǵÚ1 ºÍµÚ4Öз½Ê½£¬½ÓÏÂÀ´ÎÒÃÇÀ´¿´¿´ÕâÁ½ÖÖ·½Ê½£º
ÎÒÃÇʹÓÃsql2005×Ô´øµÄÊý¾Ý¿â AdventureWorks²âÊÔ£¬
1£©
--Use Top*Top
DECLARE @Start datetime,@end datetim ......
xmlÎļþ:
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
......