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

C#Á¬½ÓSQLÊý¾Ý¿âÁ¬²»ÉÏ£¿

SqlConnection conn = new SqlConnection("server = (local)\\sqlexpress;integrated security = SSPI;database = Northwind");
            conn.Open();
Á¬½Ó²»ÉÏ£¬Ìáʾ£º

Cannot open database "Northwind" requested by the login. The login failed.
Login failed for user 'hp-326-PC\hp-326'.
³õѧ£¬ÇëÖ¸µã
Óû§ÃûºÍÃÜÂëûÓÐ

SqlConnection conn = new SqlConnection(
"Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;");

ÕÒµ½loginµÄusertºÍpsssword,²¹Éϼ´¿É¡£

requested by the login. The login failed
ÒªÇóµÇ½,µ«µÇ½ʧ°Ü.
NorthwindÒ»°ãÊÇûÓÐÓÃÃÜÂëµÄ


        string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ÄãµÄÁ¬½Ó×Ö·û´®"].ToString();


http://blog.csdn.net/clzdl/archive/2009/07/10/4338284.aspx

SqlConnection conn = new SqlConnection("server = (local)\\sqlexpress;database = Northwind" uid=sa; pwd=123);

uid ÊǵǽÃû
pwd ÊÇÃÜÂë

ÊÔһϿÉÒÔ²»


»òÕßÓÃsql×Ô¼º´øµÄĬÈϵÄÕË»§Á¬½ÓÒ²¿ÉÒԵģ¡

uid
pwd
¿ÉÄÜÄãÁ¬½ÓÊý¾Ý¿âÊÇûÓÐдÃÜÂëºÍÓû§¡£

ÄãÓÃvsÀïÃæµÄServer ExplorerÁ¬½ÓÒ»ÏÂÊý¾Ý¿âµÄ£¬Èç¹ûÄÜÁ¬ÉÏ£¬°ÑÁ¬½Ó×Ö·û´®¿½Ò»ÏµľͿÉÒÔÁË

¿ÉÄÜÄãÁ¬½ÓÊý¾Ý¿âÊÇûÓÐдÃÜÂëºÍÓû§¡£

»òÕßÊÇsqlexpress·þÎñδÆô¶¯

ÓûìºÏģʽ ×Ö·û´®ÊÇ


Ïà¹ØÎÊ´ð£º

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ï棡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεĻ°¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

access ÖÐÖ´ÐÐsqlÓï¾äupdate²»³É¹¦£¬ÇóÖú£¡£¡£¡

access ÖÐÖ´ÐÐsql updateÓï¾äʱÓÐʱºò³É¹¦ÓÐʱºò²»³É¹¦£¬µ«ÊÇaccessÖв»³ö´íÎóÐÅÏ¢£¬²»ÖªµÀÊÇʲôԭÒò£¬ÓÐÄÄλ´óÏÀÖªµÀ£¬Çë°ïæ°¡
ÌùSQLÓï¾ä£¬¼ì²é±í¡¢×ֶεÄÓÐЧÐÔÉèÖÃ

sql ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæ Ö´ÐкÜÕý³£

ÊÇ ......

´ÓORACLEµ½DB2µÄSQLÓï¾äÎÊÌâ

ÏÖÔÚÓÐÒ»ORACLEÖеÄSQLÓï¾ä£¬ÐèÒªÒÆÖ²µ½DB2ÖУ¬ÇëÎʸÃSQL¸ÄÈçºÎд
ORACLEÖУº
select floor(months_between(date1,date2)) from A  
date1,date2·Ö±ðΪ±íÖеÄÁ½¸ö×ֶΠ£¬¶¼ÎªÈÕÆÚÐÍ 
DB2ÖÐÈçºÎʹÓÃÐ ......

ÇóÒ»Ìõoracle¶à±í²éѯµÄsql£¬Çó¸ßÊÖÃDz»ÁߴͽÌ~

table1:
uID    uName
1      СÀî 
2      СÕÅ

table2:
pID  uID  type
1    1    H1
2    ......

OracleÖвéѯ×òÌì00£º00µ½½ñÌì00£º00µÄsqlÔõôд£¿

ÔÚOracleÖУ¬ÎÒÏë²éϵͳʱ¼äÒ»ÌìµÄÊý¾Ý£¬Ê¹ÓÃÕâ¸öÓï¾ä
select * from tablename
where create_time>SYSDATE-1
and create_time <SYSDATE


ÎÒÏë²é×òÌì00£º00µ½½ñÌì00£º00µÄsqlÔõôд£¬
» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ