linq to sql Ïê
×î½üѧϰ linq to sql ¸Ð¾õ»¹ÊÇ¿ÉÒԵ쬷½±ã¿ì½Ý£¬ÒÔǰÎÊÊÇÒÔΪ²»ºÃÓ㬲»ÏëÓ㬵«ÊǽñÌìÓÃÁËһϸоõ»¹ÊDz»´íµÄ£¬ ȷʵÊǿ죬µ«ÊÇÎÒÓÖÔÚÏë
Èç¹û³ö´íÁËÔõô°ì£¬ÕâÑùÒ»¸öÀàÀï·ÅÄÇô¶àµÄÎļþÊÇÓе㲻ºÃ£¬ÔÙ˵ÁË linq to sql µÍ²ã²»ÖªµÀÔõôʵÏֵ쬻¹ÊÇûÓÐ×Ô¼ºÐ´µÄ·ÃÎʸоõÊæ·þµãºÇºÇ£¡£¡£¡
Èç¹ûÊÇ¿ìËÙ¿ª·¢Óà linq to sql »¹ÊDz»´íµÄÑ¡Ôñ°¡£¡£¡£¡
-
»ù±¾µÄÔöɾ³ý¸Ä²é
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace WebServiceText
{
/// <summary>
/// Service1 µÄժҪ˵Ã÷
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// ÈôÒªÔÊÐíʹÓà ASP.NET AJAX ´Ó½Å±¾Öе÷ÓÃ´Ë Web ·þÎñ£¬ÇëÈ¡Ïû¶ÔÏÂÐеÄ×¢ÊÍ¡£
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
DataClasses1DataContext context = new DataClasses1DataContext();
[WebMethod]
public List<Text> selectSwhere(int startid,int endid)
{
var result = (from text in context.Text
where text.id >= startid && text .id <=endid
select text).ToList<Text>();
return result;
}
[WebMethod]
public List<Text> selectAll()
{
return context.Text.ToList<Text>();
}
/// <summary>
/// Ìí¼ÓÒ»¸öÊý¾Ý
/// </summary>
/// <param name="sex">ÐÔ±ð</param>
/// <param name="age">ÄêÁä</param>
/// <returns>³É¹¦ÎªTrue·ñÔòΪFalse</returns>
[WebMethod]
public List<Text> addText(string sex, int age)
{
Te
Ïà¹ØÎĵµ£º
ΪÁËÑо¿Ò»ÏÂϵͳÔÚºǫ́¶¼¸ÉÁËʲô£¬µ±È»ÊÇÎÒÔÚ´úÂëÀïûÕÒµ½µÄÇé¿öÏ£¬Ñо¿ÁËÒ»ÏÂtrace£¬½á¹ûÓÐÒ»¶¨µÄ°ïÖú¡£oracleÖв»Ïñsql serverÖÐÄÇÑùÖ±½ÓÌṩͼÏñ»¯µÄ¹¤¾ß£¬ËùÒÔ»¹ÊǵÃ×Ô¼º¶¯ÊÖÀ´×ö£¬¹éÄÉÁËһϣ¬²½ÖèÈçÏ£º
²éѯsession£º
SQL> select sid, serial#, username from v$session where username='XXX';//ÕÒ³öÄãÒª¸ú ......
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄÇ ......
--»ù´¡Á˽⣺
1) select distinct name from table --´ò¿ªÖظ´¼Ç¼µÄµ¥¸ö×Ö¶Î
2) select * from table where fid in(Select min(fid) from table group by name)--´ò¿ªÖظ´¼Ç¼µÄËùÓÐ×Ö¶ÎÖµ
3) select * from table where name in(select name from table group by name having count(name)=1)--´ò¿ªÖظ´ÈÎÒâ´ÎÊýµ ......
¹«Ë¾Óиö±¨±íϵͳÏìÓ¦ËٶȲ»ÊǺÜÀíÏ룬µ÷Óŵ÷Á˺ü¸´Î£¬ÓеãЧ¹û£¬µ«²»ÊǺÜÈÃÈËÂúÒâ¡£×î½üÓÖ¿ªÊ¼µ÷ÓÅ£¬ÊÔÁËÊÔsql server 2008µÄ·ÖÇø±í¹¦ÄÜ£¬¿´¿´ÊDz»ÊÇ·ÖÇøÖ®ºóËÙ¶È¿ÉÒÔ¿ìÒ»µã¡£
ÓÃÁËÒ»¸ö°ÙÍò¼¶Êý¾ÝµÄ»ã×ܱíÀ´×ö·ÖÇø£¬·ÖÇøµÄÏë·¨Êǰ´ÔÂÀ´·ÖÇø£¬Ò»¸ö·ÖÇø´æ´¢Ò»¸öÔµÄÊý¾Ý£¬Ò»¸ö·ÖÇøµ ......
ÎÄÕÂÀ´Ô´£ºHttp://www.simple-talk.com
ÔÎĵØÖ·£ºhttp://www.simple-talk.com/sql/learn-sql-server/managing-transaction-logs-in-sql-server/
Ô×÷ÕߣºRobert Sheldon
·Ò룺Èý½úÒ»Ö¦»¨
ÒëÎÄÔµØÖ·£ºhttp://prj.souty.cn/Admin/Knowledges/ShowKnowledge.aspx?id=44dbde74-d2c5-41a5-a8e9-375ba7103025
ÔÚ SQL Serv ......