linq to sql ·ÖÒ³ µÄ¼¸ÖÖ·½·¨
1.Êý¾ÝµÄ·Ö²¼Skip()ºÍtake()
Skip(100)´ú±íÌø¹ý100Ðкó.´ÓµÚ101ÐпªÊ¼·ÖÒ³;
take(10)±íʾ¶àÉÙÐзÖÒ³;
Àý:
var result=from pdt in db.Product
select pdt;
this.dataview.DataSource=result.Skip(10).take(10);
this dataview.DataBind();
×¢:ÕâÖÖ·½Ê½Ò»´ÎÐÔ²éѯ³öÀ´ËùÓÐÊý¾Ý,È»ºóÔÙ·ÖÒ³;
2.ÏÂÃæµÄ·½Ê½ÊÇÿ¸öÌύʱ°ó¶¨µÄ¶¼ÊÇÌض¨µÄÊý¾Ý,¶ø·ÇËùÓÐÊý¾Ý;
public overridevoid DataBind()
{
db.log=this.response.output;
var result=from pdt in db.product
select pdt;
int skipNumber=Int.parse(this.textbox1.text)*10;
this.dataview.DataSource=result.Skip(skipNumber).take(10);
this dataview.DataBind();
}
protected void NextButton_Click(Object sender,EventArgs e)
{
this textbox1.text=(int.parse(this.textbox1.text)+1).ToString);
this.DataBind();
}
protected void form_Load(Object send,EventArgs e)
{
if (!this.IsPostBack)
{
this.DataBind();
}
}
4¡¢
·Ñ»°²»¶à˵£¬Ö÷ÒªÊÇLinqÖеÄSkip¼°TakeÕâ¶þ¸öÀ©Õ¹·½·¨
int RecordCount = 0;
int PageCount = 1;
DataClassesDataContext data = new DataClassesDataContext();
int SkipIndex = 0;
private string _PageString = "";
public string PageString
{
get {
return _PageString;
}
set {
_PageString = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
RecordCount = data.Orders.Coun
Ïà¹ØÎĵµ£º
»Ö¸´Ä£Ê½£¨Recovery Model£©Ö¼ÔÚ¿ØÖÆÊÂÎñÈÕ־ά»¤¡£»Ö¸´Ä£Ê½ËµÃ÷Á˹¤×÷¶ªÊ§µÄ·çÏÕ£¬ÄÜ·ñ»Ö¸´µ½Ê±µã£¿
SQL ServerÊý¾Ý¿âÓÐÈýÖÖ»Ö¸´Ä£Ê½£º¼òµ¥»Ö¸´Ä£Ê½¡¢ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½¡£
Ïà¶ÔÓÚ¼òµ¥»Ö¸´Ä£Ê½¶øÑÔ£¬ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½ÌṩÁ˸üÇ¿µÄÊý¾Ý±£»¤¹¦ÄÜ¡£ÕâЩ»Ö¸´Ä£Ê½¶¼ÊÇ»ùÓÚ±¸·ÝÊÂÎñÈÕÖ ......
Óŵã:×ֶνÏÉÙ£¬ÓÐÔöɾ¸Ä²é¹¦ÄÜ£¬²»¹ý²éѯ̫Áýͳ¡£
ȱµã:
1.²»ËãÊÇÔÚºÜÕýµÄÎÞÏÞ·ÖÀà,ClassPathÕâ¸ö×ֶζ¨ÒåÏÞÖÆ¡£
2.Ö÷¼üCLASSID²»ÊÇ×ÔÔöµÄ£¬Ê¹ÓÃCODESMITHÅúÁ¿Éú³É¶à²ã¼Ü¹¹´úÂëÖлᵼÖ³ö´í¡£
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUse ......
Ê×ÏÈÓòéѯÓï¾ä£¬´ÓtblTask±íÖвéѯ³öËùÓеÄÊý¾Ý£¬È»ºó½«Æä±£´æΪcsv¸ñʽ¡£
ÔÚSQLÓï¾ä´°¿Ú£¬ÊäÈëÈçÏÂÄÚÈÝ£º
USE Keii BULK INSERT dbo.tblTask
& ......
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃExecÖ´ÐÐ
Àý: Select * from tableName
Exec('select * from tableName')
& ......
ÔÚʹÓÃNHibernate¹ý³ÌÖо³£»áʹÓõ½¸´ÔÓµÄsql²éѯ£¬µ«ÊÇʹÓÃhqlÓֱȽÏÂé·³µÄÇé¿öÏ£¬ÎÒÃÇÍùÍù¶¼»áÏëµ½²ÉÓÃÔʼµÄsqlÀ´Ö´ÐС£µ«ÊÇÈçºÎÀûÓÃNHibernateÀ´Ö´ÐÐsqlÄØ£¿ÎÊÌâÀ´ÁË£¬ÔÚNHibernateÖÐÒ²ÓÐAdoTemplateµÄ·½·¨¿ÉÒÔÖ´ÐÐsqlµÄ£¬µ«ÊÇÕâÀïÒª½éÉܵÄÊÇÁíÍâÒ»ÖÖ·½·¨£ºCreateSQLQuery¡£ÒÔϲ¿·ÖÀý×ÓÔ´×ÔÓÚÍøÂç¡£
ʵÀýÒ»£¨Ô´×ÔÓÚ ......