積累經驗, 總結看到的好文章。

來源:互聯網
上載者:User

1、動態綁定DropDownList時,要注意綁定Text和Value,顯示的是Text,程式中提取的是Value;
 
2、

cross join 是笛卡兒乘積 就是一張表的行數乘以另一張表的行數
left  join 第一張表的串連列在第二張表中沒有匹配是,第二張表中的值返回null
right join 第二張表的串連列在第一張表中沒有匹配是,第一張表中的值返回null
full  join 返回兩張表中的行 left join+right join
inner join 只返回兩張表串連列的匹配項

3、漸層樣式微軟版本--太棒了

<td style="FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#336699', endColorStr='#ffffff', gradientType='1')" vAlign="top" align="center">

效果看到了吧

startColorStr='起始顏色'
endColorStr='結束顏色'
gradientType='1' // 1為橫向漸層,0位縱向漸層

4、資料繫結之數組綁定
1>
 ArrayList values = new ArrayList();

values.Add ("北京");
values.Add ("上海");
values.Add ("廣州");

ListBox1.DataSource = values;
ListBox1.DataBind();

2>

string [] arrs="aa,bb,cc".Split(',');
this.DataGrid1.DataSource=arrs;
this.DataGrid1.DataBind();

ItemTemplate綁定語句

<asp:BoundColumn DataField="!" HeaderText="test"/>
<asp:TemplateColumn HeaderText="test">
    <ItemTemplate>
    <%#Container.DataItem%>
    </ItemTemplate>
</asp:TemplateColumn>


5、資料繫結之HashTable綁定

1>

Hashtable hash = new Hashtable();

hash.Add("北京", "010");
hash.Add("廣州", "020");
hash.Add("上海", "021");
hash.Add("天津", "022");

RadioButtonList1.DataSource = hash;
RadioButtonList1.DataTextField = "Key";
RadioButtonList1.DataValueField = "Value";
RadioButtonList1.DataBind();

2>(適用一個產品多個圖片的情況)

Hashtable hash = new Hashtable();
   hash.Add("002", "proPic/2.jpg");
   hash.Add("001", "proPic/1.jpg");
   hash.Add("003", "proPic/3.jpg");

   DataList1.DataSource = hash;
   DataList1.DataBind();

ItemTemplate綁定語句

<ItemTemplate>
     <img src='<%# DataBinder.Eval(Container.DataItem,"Value") %>'>
       <br> <%# DataBinder.Eval(Container.DataItem,"key") %>
</ItemTemplate>

6、簡單分頁代碼

第一步:通過編碼獲得它在資料中的排名
select count(*) from tpdetail where id>(select id from tpdetail where pNum='24110205')

第二步:根據排名,進行分頁

select top 1 * from (select top 4 * from tpdetail order by ID desc) as a order by ID asc

7、根據關聯表修改資訊

-----修改資訊,按尺碼修改

UPDATE TPMStorage
SET XXS2435 =StoTrue FROM TPMStorage INNER JOIN
      TPStorage ON TPMStorage.StoNum = TPStorage.StoNum AND
      TPMStorage.StoColor = TPStorage.StoColor WHERE StoSpec='XXS' OR StoSpec='24' OR (StoSpec='35' AND substring(TPStorage.StoNum,1,2)='21')

8、cmd.ExecuteScalar 的傳回值有可能為null,此時要將他轉換成ToString()就會出錯,此點要注意。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.