sql ÅÅÐòʧЧ
ÎÒ¶Ô gridview µÄÿÁÐÆôÓÃÁËÅÅÐò £¬ÔÚÈ¡Êý¾Ýʱ µÄsql Óï¾ä µÄ orer by ÅÅÐò¾ÍʧЧÁË
ÏÂÃæÊÇ ÅÅÐòµÄ´úÂë
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ this.GridView1.Attributes.Add("SortExpression", "id");
this.GridView1.Attributes.Add("SortDirection", "ASC");
this.BindGridView();
}
}
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
string sortExpression = e.SortExpression.ToString();
// ¼Ù¶¨ÎªÅÅÐò·½ÏòΪ¡°Ë³Ðò¡±
string sortDirection = "ASC";
// ¡°ASC¡±Óëʼþ²ÎÊý»ñÈ¡µ½µÄÅÅÐò·½Ïò½øÐбȽϣ¬½øÐÐGridViewÅÅÐò·½Ïò²ÎÊýµÄÐÞ¸Ä
if (sortExpression == this.GridView1.Attributes["SortExpression"])
{
//»ñµÃÏÂÒ»´ÎµÄÅÅÐò״̬
sortDirection = (this.GridView1.Attributes["SortD
Ïà¹ØÎÊ´ð£º
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......
ÐèÇóÈçÏ£º
a±í:
p_id status
1 0
2 0
b±í
rec_id pid purchase_qty receive_qty flag
1 1 10 10 0
2 ......
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÌâÄ¿£º°Ñ¡°SC¡±±íÖС°Ò¶Æ½¡±ÀÏʦ½ÌµÄ¿ÎµÄ³É¼¨¶¼¸ü¸ÄΪ´Ë¿Î³ÌµÄƽ¾ù³É¼¨£»
update SC set sco ......
´ó¼ÒºÃ£¬ÎÒ×î½üά»¤Ò»¸öÏîÄ¿£¬100¶à¸ö±í
Ö»ÄÜÓÃjdbcÖ±Á¬
Óöµ½Á˶à¸ö±í ¹ØÁª ²éѯµÄÇé¿ö Çë´ó¼ÒÖ¸½Ì
±ÈÈç
student(studentid,classid)
class(classid,classname)
class_teacher(classid,teacherid)Õâ¸öÊÇÖмä±í ......