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

LINQ to SQL ÔÚ Visual Studio 2008 Öеļòµ¥Ó¦ÓÃ


ÔÚ.Net Framework 3.5 ÖУ¬×¶¯ÈËÐĵľÍÊÇÔö¼ÓÁËLINQ¹¦ÄÜ£¬LINQÔÚÊý¾Ý¼¯³ÉµÄ»ù´¡ÉÏÌṩÁËеÄÇáÐÍ·½Ê½¡£ÓÐÁËLINQ£¬ÎÒÃÇ´´½¨µÄ²éѯÏÖÔھͱà³ÌÁË.Net ¿ò¼ÜµÄÒ»¸ö³ÉÔ±£¬ÔÚ¶ÔÒª²Ù×÷µÄÊý¾Ý´æ´¢Ö´Ðвéѯʱ£¬»áºÜ¿ì·¢ÏÖËûÃÇÏÖÔڵIJÙ×÷·½Ê½ÀàËÆÓÚϵͳÖеÄÀàÐÍ¡£Õâ˵Ã÷£¬ÏÖÔÚ¿ÉÒÔʹÓÃÈÎÒâ¼æÈÝ.Net µÄÓïÑÔÀ´²éѯµ×²ãµÄÊý¾Ý´æ´¢£¬ÕâÔÚÒÔÇ°ÊDz»¿ÉÄܵġ£
¸ù¾ÝÒªÔÚÓ¦ÓóÌÐòÖд¦ÀíµÄµ×²ãÊý¾ÝµÄ²»Í¬£¬Óв»Í¬ÀàÐ͵ÄLINQ¹¦ÄÜ£º
LINQ to Objects
¶ÔÏóÖ»²»¹ýÊÇ´æ´¢ÔÚÄÚ´æÖеÄÊý¾Ý£¬¶ÔÏó±¾Éí¿ÉÄܾÍÊDzéѯÊý¾Ý£¬´Ëʱ¿ÉÒÔʹÓÃLINQ to Objects
LINQ to SQL¡¢LINQ to DataSets ºÍ LINQ to Entities ÌṩÁ˲éѯ¹ØϵÐÍÊý¾ÝµÄ·½Ê½£¬Ö±½Ó·ÃÎÊÊý¾ÝºÍ´æ´¢¹ý³Ì£¬¼°±íʾ±íʾÌåÖ®¼äµÄ¹Øϵ£¬Ö´ÐÐÌíɾ¸Ä²é¡£
LINQ to XML
LINQ to SQL ºÍ Visual Studio 2008
LINQ to SQL ÊÇÔÚSQL Server Êý¾Ý¿âÉÏÉèÖÃÒ»¸öÇ¿ÀàÐÍ»¯½çÃæµÄ·½Ê½£¬ÌṩÁËÄ¿Ç°²éѯSQL Server ×î¼òµ¥µÄ·½·¨¡£
ÏÂÃæÒª´´½¨Ò»¸öʾÀý£¬´ÓNorthwindÊý¾Ý¿â£¨SQL Server 2000 ʾÀýÊý¾Ý¿â ÏÖÔÚÖ»Äܵ½ÍøÉÏËÑË÷ÏÂÔØÁË£©µÄProducts ±íÖÐÌáÈ¡Êý¾ÝÏî
Ò»£¬ÓÃVSTS 2008 н¨Ò»¸öC# Web Ó¦ÓóÌÐò£¨.Net 3.5£©
¶þ£¬ÓÒ¼üΪÏîÄ¿Ìí¼ÓÒ»¸öLINQ to SQL Àà ²¢ÎªÆäÃüÃûΪºÍÊý¾Ý¿âÏàͬµÄÃû×Ö£¬ÈÝÒ×ʶ±ð¡£

È·¶¨£¬½á¹ûÈçÏ£¬¿É¼ûORÉè¼ÆÆ÷±»´ò¿ª

ORÉè¼ÆÆ÷ÓÉÁ½²¿·Ö×é³É£º
×ó±ß²¿·ÖÓÃÓÚÏÔʾÊý¾ÝÀ࣬Ëü¿ÉÒÔÊÇ±í¡¢Àà¡¢¹ØÁªºÍ¼Ì³Ð¡£
Óұ߲¿·ÖÓÃÓÚÏÔʾ·½·¨£¬ÕâЩ·½·¨Ó³Éäµ½Êý¾Ý¿âÖеĴ洢¹ý³ÌÉÏ¡£
Èý£¬´´½¨±í¶ÔÏó
ÔÚ´´½¨±í¶ÔÏó֮ǰ£¬ÎÒÃÇÏÈÓ÷þÎñÆ÷×ÊÔ´¹ÜÀíÆ÷½¨Á¢¶ÔNorthwindÊý¾Ý¿âµÄÒýÓá£
ÓÒ¼üÊý¾ÝÁ¬½Ó½Úµã->Ìí¼ÓÁ¬½Ó£¬´ò¿ªÌí¼ÓÁ¬½Ó¶Ô»°¿ò

ÊäÈë·þÎñÆ÷Ãû£¬ÃÜÂ룬²¢Ñ¡ÔñÊý¾Ý¿âÖ®ºóµãÈ·¶¨°´Å¥¡£Êý¾Ý¿â±»Ìí¼ÓÁ˽øÀ´¡£

´ò¿ª´ËÊý¾Ý¿âµÄ±íÎļþ¼Ð£¬Ñ¡ÔñProduct ±íÓÃÊó±êÖ±½ÓÍ϶¯µ½ORÉè¼ÆÆ÷ÉÏ£¬½á¹ûÈçÏÂ

ͬʱWeb.Config ÎļþÖлáÌí¼ÓÈçϵÄÁ¬½ÓÐÅÏ¢£¬ÔÚNorthwind.designer.csÎļþÖл¹»áÌí¼ÓÏàÓ¦µÄÓ³ÉäÉè¼Æ´úÂë
<connectionStrings>
<add name="NorthwindConnectionString" connectionString="Data Source=TERRYFENG-PC;Initial Catalog=Northwind;Persist Security Info=True;User ID=sa;Password=saaaaa"
providerName="System.Data.SqlClient" />
</connectionStrings>
ÔÚORÉè¼ÆÆ÷µÄÊôÐÔ´°¿ÚÖУ¬ÎÒÃÇ¿ÉÒÔ¿´µ½Á¬½Ó´®µÈÐÅÏ¢

´ò¿ªDefault.aspx Îļþ£¬ÏòÆäÖÐÍ϶¯Ò»¸öGridView ¿Ø¼þ£¬²¢ÔÚºó


Ïà¹ØÎĵµ£º

Oracle Sql¼¼ÇÉ Upsert, Multitable Insert, Undrop

UpSert¹¦ÄÜ£º
MERGE <hint> INTO <table_name>
USING <table_view_or_query>
ON (<condition>)
WHEN MATCHED THEN <update_clause>
WHEN NOT MATCHED THEN <insert_clause>;
MultiTable Inserts¹¦ÄÜ£º
Multitable inserts allow a single INSERT INTO .. SELECT statement to ......

sql ºº×ÖתÊ××ÖĸƴÒô

create function fun_getPY(@str nvarchar(4000))
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
set @word=left(@str,1)
--Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ­×Ö·û
set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901 ......

SQLÉí·ÝÖ¤¸ñʽÑéÖ¤


SQL°æ±¾Éí·ÝÖ¤¸ñʽÑéÖ¤ 0Ϊ´íÎó£¬1ΪÕýÈ·
CREATE  function [dbo].[IsID](@str nvarchar(18),@sex int)--´«ÈëÁ½¸ö±äÁ¿ Éí·ÝÖ¤ºÍÐÔ±ð(ÄÐ1Å®2)
returns bit
as
begin
declare @len int
declare @result bit
--set @result=0
set @len=len(@str)
if(@len!=18 and @len!=15)--³¤¶ÈÊÇ18λ»ò15λ
 begin
& ......

Ãâ°²×°Oracle¿Í»§¶ËʹÓÃPL/SQLÁ¬½ÓOracle


´ó¼Ò¶¼ÖªµÀ£¬ÓÃPL/SQLÁ¬½ÓOracle£¬ÊÇÐèÒª°²×°Oracle¿Í»§¶ËÈí¼þµÄ¡£ÓÐûҪÏë¹ý²»°²×°Oracle¿Í»§¶ËÖ±½ÓÁ¬½ÓOracleÄØ£¿
      ÆäʵÎÒÒ»Ö±ÏëÕâÑù×ö£¬ÒòΪÕâ¸ö¿Í»§¶ËʵÔÚÌ«ÈÃÈËÌÖÑáÁË£¡£¡£¡²»µ«»á°²×°Ò»¸öJDK£¬¶øÇÒ»¹»á°Ñ×Ô¼º·ÅÔÚ»·¾³±äÁ¿µÄ×îÇ°Ã棬»áÔì³É²»Ð¡µÄÂé·³¡£
    &n ......

Ìí¼ÓÊý¾ÝÔ´²¢ÅäÖÃÊý¾ÝÔ´Óësql ServerÉí·ÝÑé֤ģʽ

      ÔÚÊý¾Ý¿âÓ¦ÓóÌÐò·¢²¼Ê±£¬¿Í»§¶Ë°²×°ÔÚ¾ÖÓòÍøÖеÄÖ÷»úAÉÏ£¬sql server °²×°ÔڸþÖÓòÍøµÄÖ÷»úBÉÏ¡£¿Í»§¶ËÈí¼þÖаüº¬ÓÐËüÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÐÅÏ¢¡£ÈçÊý¾ÝÔ´£¬·þÎñÆ÷Ãû³Æ£¬Êý¾Ý¿âµÈ£¬ÊµÀý£ºdata source=SQLOLEDB;SERVER=DongZi\sqlExpress;uid=sa;pwd=123;database=MachineRoom
¡£ÄÇôÎÒÃÇÔÚÖ÷» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ