DelphiʹÓÃiniÅäÖÃÎļþÁ¬½ÓMS SQLÊý¾Ý¿â
ºÜÔç×ö¹ýµÄÒ»¸ödelphiÏîÄ¿£¬°ÑÀïÃæÓõ½µÄ¼¼Êõ×ܽáһϣ¬Ö÷ÒªÊÇÕë¶ÔÏóÎÒÕâÑùµÄdelphiÐÂÊÖ£¬¼¼ÊõÉÏ×ö¸ö»ýÀÛ°É£¡
¼ÙÉèÎÒÃǵÄÊý¾Ý¿âÅäÖÃÎļþServerInfo.iniÄÚÈÝÈçÏ£º
[ServerInfo]
ServerIP=192.168.1.5
SQLDBName=Data
SQLUserID=sa
SQLPwd=
ÎÒÃǶ¨ÒåÒ»¸öÁ¬½ÓÊý¾Ý¿âµÄ¹ý³ÌDBConnectÄÚÈÝÓ¦ÈçÏÂ
procedure TDM.DBConnect();
var
ini:TiniFile;
Server,User,Pass,DBName:string;
begin
ini := TiniFile.Create(ExtractFilePath(Application.ExeName)+'dbconn.ini'); //³õʼ»¯iniÎļþ
Server := ini.ReadString('serverinfo','ServerIP',''); //Êý¾Ý¿âipµØÖ·
DBName := ini.ReadString('serverinfo','SQLDBName',''); //Êý¾Ý¿âÃû
User := ini.ReadString('serverinfo','SQLUserID',''); //Êý¾Ý¿âÓû§Ãû
Pass := ini.ReadString('serverinfo','SQLPwd',''); //Êý¾Ý¿âÃÜÂë
try
DM.ADOConn.ConnectionString := 'Provider=SQLOLEDB.1;Persist Security Info=False;'
+'User ID='+trim(User)
+';Password='+trim(Pass)
+';Initial Catalog='+trim(DB)
+';Data Source='+trim(Server);
DM.ADOConn.Open ;
except
application.MessageBox('Êý¾Ý¿âÁ¬½Óʧ°Ü£¬Çë¼ì²éINIÅäÖÃÎļþ','Ìáʾ',64);
application.Terminate ;
end;
end;
ÏàÐÅ´ó¼Ò¶¼ÄÜ¿´¶®£¬×¢ÒâʹÓÃTiniFileÀàµÄº¯Êý»ò¹ý³ÌÓ¦ÒýÈëINIFilesµ¥Ôª¡£
Ïà¹ØÎĵµ£º
ÔÚVisual Studio 2008 ÖÐʹÓÃO/RÉè¼ÆÆ÷£º
µãÌí¼ÓÏîÄ¿£¬Ñ¡Ôñ´´½¨Linq to SQLÏîÄ¿£¬Ê¹Ó÷þÎñÆ÷×ÊÔ´¹ÜÀíÆ÷Á¬½ÓNorthwindÊý¾Ý¿â£¬½«CustomersºÍOrdersÁ½¸ö±íÍϵ½Éè¼Æ½çÃæÉÏ£¬ÏµÍ³»á×Ô¶¯´´½¨app.configºÍNorthwid.designer.cs,ǰÕßÊÇÅäÖÃÁ¬½ÓÊý¾Ý¿âµÄÁ¬½Ó×Ö´®£»ºóÕß»áÉú³ÉÒ»¸ö¼Ì³Ð×ÔDataContextµÄÀࣺNorthwindDataContext¡£
......
sql ·þÎñÆ÷½ÇÉ« Êý¾Ý¿â½ÇÉ«
·þÎñÆ÷½ÇÉ«
ËùÓеķþÎñÆ÷½ÇÉ«¶¼ÊÇ“¹Ì¶¨µÄ”½ÇÉ«£¬²¢ÇÒ£¬´ÓÒ»¿ªÊ¼¾Í´æÔÚÓÚÄÇÀï——×Ô°²×°ÍêSQL ServerµÄÄÇÒ»¿ÌÆð£¬Ä㽫ӵÓеÄËùÓзþÎñÆ÷½ÇÉ«¾ÍÒѾ´æÔÚÁË¡£
½Ç¡¡¡¡É«
ÌØ¡¡¡¡ÐÔ
sysadmin
¸Ã½ÇÉ«Äܹ»Ö´ÐÐSQL ServerÉϵÄÈκβÙ× ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
----------------------------------------------------------------------
1¡¢SQLÊý¾Ý¿â»Ö¸´Ä£ÐÍ
----------------------------------------------------------------------
1£©ÍêÈ«»Ö¸´Ä£ÐÍ
-----------------
£¨1£©±¸·ÝʱҪ±¸·ÝÊý¾Ý¿âµÄÊý¾ÝÎļþºÍÈÕÖ¾Îļþ
£¨2£©»¹ÔʱʹÓÃÊý¾Ý¿âµÄ±¸·ÝµÄÊý¾ÝÎļþ¸±±¾ºÍÈ«²¿ÈÕÖ¾ÐÅ ......
²Ù
×÷ϵͳµÄÖ§³Ö
°æ
±¾ºÍ·¢Ðаæ
ʵ
Àý¡¢Êý¾Ý¿âºÍ±í¿Õ¼ä
ʵ
ÀýÃûºÍSID
ϵ
ͳÊý¾Ý¿âºÍϵͳ±í¿Õ¼ä
±¾ÒëÎIJÉÓÃ֪ʶ¹²ÏíÊð
Ãû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 3.0 UnportedÐí¿ÉÐÒé
·¢²¼£¬×ªÔØÇë±£Áô´ËÐÅÏ¢
ÒëÕߣºÂí³ÝÜÈ | Á´½Ó£ºhttp://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
×÷ÕߣºS ......