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

.NETѧϰÊÖ¼ÇÖ®£ºlinq to SQL(Ò»)


Ò»¸ö¼òµ¥µÄÀý×Ó£º
ÏȽ¨Ò»¸öC#Àࣺ
ÒýÓÃSystem.Data.Linq.dll³ÌÐò¼¯£¬
using System.Data.Linq.MappingºÍ
using System.Data.Linq Á½¸ö¿Õ¼ä¡£
[Table]
public class Inventory
{
   [Column]
   public string Make;
   [Column]
   public string Color;
   [Column]
   public string PetName;
  
   //Ö¸Ã÷Ö÷¼ü¡£
   [Column(IsPrimaryKey = true)]
   public int CarID;
  
   public override string ToString()
   {
       return string.Format(
        "±àºÅ={0};ÖÆÔìÉÌ={1};ÑÕÉ«={2};°®³Æ={3}",
         CarID,Make.Trim(),Color.Trim(),PetName.Trim());
   }
}
ÓëSQL(express°æ)Êý¾Ý¿â½»»¥:
class Program
{
   const string cnStr=
       @"Data Source=(local)\SQLEXPRESS;Initial Catalog=Autolot;"+
            "Integrated Security=True";
   static void Main(string[] args)
   {
       Console.WriteLine("*****LINQ to SQL ¼òµ¥Ó¦ÓÃ*****");
       //´´½¨Ò»¸öDataContext¶ÔÏó¡£
       DataContext db= new DataContext(cnStr);
       //´´½¨Ò»¸öTable<>·ºÐÍʵÀý¡£
       Table<Inventory> invTable = db.GetTable<Inventory>();
       //ÓÃÒ»¸öLINQ²éѯÏÔʾ½á¹û¡£
       foreach(var car in from c in invTable select c)
           Console.WriteLine(car.ToString());
   }
   Console.ReadLine();
}
¶ÔDataContextÀà½øÐÐÀ©Õ¹£º
class MyAutoLotDatabase:DataContext
{
   public Table<Inventory> Inventory;
   public MyAut


Ïà¹ØÎĵµ£º

PL/SQLʵÀý·ÖÎö

PL/SQLʵÀý·ÖÎö
µÚÎåÕÂ
1¡¢PL/SQLʵÀý·ÖÎö
1£©ÔÚ¡¾SQLPlus Worksheet¡¿ÖÐÖ±½ÓÖ´ÐÐÈçÏÂSQL´úÂëÍê³ÉÉÏÊö²Ù×÷¡£(´´½¨±í)
¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D¨D

CREATE TABLE "SCOTT"."TESTTABLE" ("RECORDNUMBER" NUMBER(4) NOT NULL, "CURRENTDATE" DATE NOT NULL)
TABLESPACE "SYSTEM ......

Ñ­Ðò½¥½ø½²½âSQL²éѯÓï¾ä¸ß¼¶Ó¦Óü¼ÇÉ

Ò»¡¢ ¼òµ¥²éѯ
¼òµ¥µÄTransact-SQL²éѯֻ°üÀ¨Ñ¡ÔñÁÐ±í¡¢from×Ó¾äºÍWHERE×Ӿ䡣ËüÃÇ·Ö±ð˵Ã÷Ëù²éѯÁС¢²éѯµÄ
±í»òÊÓͼ¡¢ÒÔ¼°ËÑË÷Ìõ¼þµÈ¡£
ÀýÈ磬ÏÂÃæµÄÓï¾ä²éѯtesttable±íÖÐÐÕÃûΪ“ÕÅÈý”µÄnickname×ֶκÍemail×ֶΡ£
SELECT nickname,email
from testtable
WHERE name='ÕÅÈý'
 
(Ò») Ñ¡Ôñ ......

sql server ¶¨ÒåÖ÷¼ü

drop table father;
create table father(
 id int identity(1,1) primary key,
 name varchar(20) not null,
 age int not null
  
)
drop table mother;
create table mother(
 id int identity(1,1),
 name varchar(20) not null,
 age int not null,
 husban ......

¡¾SQL SERVERÖÐÒ»Ð©ÌØ±ðµØ·½µÄÌØ±ð½â·¨2¡¿


/*----------------------------------------------------------------
-- Author  :feixianxxx(poofly)
-- Date    :2010-04-20 20:10:41
-- Version:
--      Microsoft SQL Server 2008 (SP1) -  ......

sql×¢Èë


ÅжÏÊý¾Ý¿âÀàÐÍ
(select count(*) fromsysobjects)>0  //sqlÊý¾Ý¿â
(select count(*) from msysobjects)>0 //accessÊý¾Ý¿â
µÃµ½SqlÓû§Ãû
 user>0
Conversion failed when converting the nvarchar value 'dbo' to data type int.
ÖØ¹¹SQLÓï¾ä
ÕûÊýÐÍ
(A) ID=49 ID=49 And [ ²éѯÌõ¼þ] £¬¼´Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ