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
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
¹ØÓÚSQL×¢Èë(SQL Injection)µÄ·½·¨Æäʵ¶¼ºÜÆÕ±éºÍʹÓ㬹éÄÉÆðÀ´Ò²ºÜ·½±ã¡£Ò»°ã“ºÚ¿Í”ʹÓõÄÊÇÏֳɵŤ¾ßÈç“WEBÅÔ×¢¡¢°¢DÍøÂ繤¾ß°ü¡¢½ÌÖ÷XXX”µÈÕâЩ¶¼ÊǼ¯³ÉÁË
һЩ³£ÓõÄsql×¢ÈëÓï¾ä¡£ÏÂÃæÎÒ½«½éÉÜÈçºÎʹÓÃÊÖ¹¤×¢ÈëMYSQL,MSSQLÊý¾Ý¿â.
Ò»°ã©¶´²ú ......
--»ù´¡Á˽⣺
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)--´ò¿ªÖظ´ÈÎÒâ´ÎÊýµ ......
--¼à¿ØË÷ÒýÊÇ·ñʹÓà alter index &index_name monitoring usage; alter index &index_name nomonitoring usage; select * from v$object_usage where index_name = &index_name;
--ÇóÊý¾ÝÎļþµÄI/O·Ö²¼ select df.name,phyrds,phywrts,phyblkrd,phyblkwrt,singleblkrds,readtim,writetim from v$filestat fs,v ......
¸Ð¾õ×Ô¼ºÊDZȽϱ¿µÄ£¬Ñ§Ï°¹ýSQLÓïÑÔ£¬µ«ÊÇÈ´·Ö²»Ì«Çå³þDDL¡¢DML¡¢DCLÓïÑÔ£¬ËùÒÔÄØ£¬½ñÌì¾Íºñ×ÅÁ³Æ¤ÎÊÁËÀÏʦ£¬ÏÖÔÚ¾Í×Ô¼ºÄ¿Ç°µÄÁ˽âÀ´×ܽáһϡ£
1¡¢DDL£¨DATA DEFINITION LANGUAGE£©Êý¾ÝÃèÊöÓïÑÔ
DDLÓï¾ä²»»á²úÉú»¹ÔÊý¾Ý£¬ËùÒÔɾ³ýµÄÊý¾ÝÒ²ÊÇÎÞ·¨»Ö¸´µÄ
CREATE - to ......