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

DelphiÁ¬½ÓSQL Server 2000

Ò»¡¢ÔÚDelphi7ÖÐÁ¬½ÓMS SQL Server 2000µÄ·½·¨¡£
¸Õ¿ªÊ¼Ê±½çÃæÈçÏ£ºÌí¼Ó4¸ö¿Ø¼þ¡£
ÉèÖÿؼþÊôÐÔ¹ý³Ì£º
1¡¢ADOConnection1ÉèÖÃ
1£©Ë«»÷ADOConnection1£¬½øÐÐÉèÖÃÁ¬½Ó×Ö·û´®£¨×÷ÓÃÊÇ£ºÑ¡È¡Á¬½ÓÇý¶¯·½Ê½ºÍÁ¬½ÓµÄÊý¾Ý¿âÉèÖã©¡£¹ý³ÌÈçÏÂͼËùʾ£º
2¡¢ADOQuery1ÉèÖ㺠
1£©ADOQuery1.connectionÊôÐÔΪADOConnection1;
2£©ADOQuery1.SQLÊôÐÔΪselect student.sno,sname,cname,grade from student,sc,course where student.sno=sc.sno and course.cno=sc.cno
3£©ADOQuery1.ActiveÉèÖÃΪTRUE¡£
3¡¢DataSource1ÉèÖÃ
DataSetÊôÐÔΪADOQuery1
4¡¢DBGrid1ÉèÖÃ
DataSourceÊôÐÔÉèÖÃΪDataSource1.
Ч¹ûͼ£º
¶þ¡¢Í¨¹ýDelphi7½øÐÐÉè¼ÆSQL²éѯµÄ½çÃæºÍ³ÌÐòʵÏÖ¡£
1¡¢½çÃæÉè¼Æ
Ìí¼ÓEdit£¬ButtonºÍLabel¿Ø¼þ£¬Èçͼ°Ú·ÅºÍÉèÖûù±¾ÊôÐÔ¡£
2¡¢ÔÚBitBtn1µÄClickʼþÄÚÍê³É³ÌÐò¡££¨Edit1ºÍEdit2µÄ×ۺϲéѯ£¬¹²4ÖÖÇé¿ö£©
procedure TForm1.BitBtn1Click(Sender: TObject);
var
i:integer;
SqlStr:String;
begin
i:=0;
if edit1.Text<>'' then
i:=i+1;
if edit2.Text<>'' then
i:=i+2;
case i of
0:
begin
SqlStr:='select student.sno,sname,cname,grade from student,sc,course '
+'where student.sno=sc.sno and course.cno=sc.cno ';
adoquery1.Close; //¹Ø±ÕADOQuery1£¬ÒÔ±ãÓÚ½øÐÐSQLÓï¾ä¸üÐÂ
adoquery1.SQL.Clear; //Çå¿ÕSQLÓï¾ä
adoquery1.SQL.Add(sqlStr); //Ìí¼ÓеÄSQL
adoquery1.Open; //ÐÂSQLÓÐЧ
end;
1:
begin
SqlStr:='select student.sno,sname,cname,grade from student,sc,course '
+'where student.sno=sc.sno and course.cno=sc.cno and sname='''+edit1.Text+'''';
adoquery1.Close; //¹Ø±ÕADOQuery1£¬ÒÔ±ãÓÚ½øÐÐSQLÓï¾ä¸üÐÂ
adoquery1.SQL.Clear; //Çå¿ÕSQLÓï¾ä
adoquery1.SQL.Add(sqlStr); //Ìí¼ÓеÄSQL
adoquery1.Open; //ÐÂSQLÓÐЧ

end;
2:
begin
SqlStr:='select student.sno,sname,cname,grade from student,sc,course '
+'where student.sno=sc.sno and course.cno=sc.cno and cname='''+edit2.Text+'''';
adoquery1.Close;


Ïà¹ØÎĵµ£º

Microsoft SQL Server ¹ÜÀí £¨³£ÓùÜÀí¼°Î¬»¤ÃüÁ

 --²éѯµ±Ç°Á¬½ÓµÄʵÀýÃû
select @@servername--²ì¿´ÈκÎÊý¾Ý¿âÊôÐÔ
sp_helpdb master
--ÉèÖõ¥Óû§Ä£Ê½£¬Í¬Ê±Á¢¼´¶Ï¿ªËùÓÐÓû§
alter database Northwind set single_user with rollback immediate--»Ö¸´Õý³£
alter database Northwind set multi_user
--²ì¿´Êý¾Ý¿âÊôÐÔ
sp_helpdb--²ì¿´Êý¾Ý¿â»Ö¸´Ä£Ê½
selec ......

Sql Server 2005/2008±¸·Ý/ɾ³ý¹ýÆÚ±¸·ÝT

 USE [master]
GO
/****** ¶ÔÏó:  StoredProcedure [dbo].[sp_backupdatabase]    ½Å±¾ÈÕÆÚ: 07/15/2009 16:23:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_backupdatabase]
@bak_path nvarchar(4000)='',       ......

Comparison of SQL and MDX Syntax

          Comparison of SQL and MDX Syntax
The Multidimensional Expressions (MDX) syntax is similar to the syntax of Structured Query Language (SQL). In many ways, the functionality supplied by MDX is also similar to that of SQL; with effort, you can eve ......

sql»ù´¡ÖªÊ¶

SQLÓïÑÔÓÉÃüÁî¡¢×Ӿ䡢ÔËËãºÍ¼¯ºÏº¯ÊýµÈ¹¹³É¡£ÔÚSQLÖУ¬Êý¾Ý¶¨ÒåÓïÑÔDDL£¨ÓÃÀ´½¨Á¢¼°¶¨ÒåÊý¾Ý±í¡¢×Ö¶ÎÒÔ¼°Ë÷ÒýµÈÊý¾Ý¿â½á¹¹£©°üº¬µÄÃüÁîÓÐCREATE¡¢DROP¡¢ALTER£»Êý¾Ý²Ù×ÝÓïÑÔDML£¨ÓÃÀ´ÌṩÊý¾ÝµÄ²éѯ¡¢ÅÅÐòÒÔ¼°É¸Ñ¡Êý¾ÝµÈ¹¦ÄÜ£©°üº¬µÄÃüÁîÓÐSELECT¡¢INSERT¡¢UPDATE¡¢DELETE¡£
Ò»¡¢SQLÓï¾ä
£¨1£©Select ²éѯÓï¾ä
Óï·¨£ºSE ......

Sql 2005Æô¶¯²»ÁË£¬±¨´íÈçÏÂʱµÄ½â¾ö°ì·¨£¡

½â¾ö°ì·¨£º
¿ªÊ¼->programs->MicroSoft SQL Server 2005->Configuration tools->SQL Server Configuration Manager
Ñ¡Ôñ SQL Server 2005 Network Configuartion-> Protocols for SQL ExpRESS ÔÙ Ñ¡Ôñ TCP/IP ÊôÐÔ  ,Ñ¡ÔñIP Addresses
IP1 µÄ IP Address ÇëÈ·ÈÏÊÇ Äã·þÎñÆ÷µÄ IPµØÖ· £¬  Èç¹û· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ