2011-9-1

来源:互联网 发布:暗黑破坏神3新手 知乎 编辑:程序博客网 时间:2024/04/29 13:35
 

2011-3-8

111.Oracle number 字段绑定问题

if (i6AppInfoEntity.Dbtype == DBType.OracleClient)

{

     this.isCheched.ValueChecked = Convert.ToInt64(1);

     this.isCheched.ValueUnchecked = Convert.ToInt64(0);

}

Else

{

     this.isCheched.ValueChecked = 1;

     this.isCheched.ValueUnchecked = 0;

}

 

2011-4-12

112. IoC 和 DI

IoC  ----    Inversion  of  Control  控制反转

DI   ----    Dependency  Injection  依赖注入

 

应用程序被动的等待IoC/DI容器来创建并注入它所需要的资源

 

2011-4-13

113. 深度克隆和浅度克隆

浅度克隆: 克隆按值传递的数据

深度克隆: 克隆浅度克隆和克隆引用类型的数据

 

2011-05-06

114.冒泡排序

private List<int> SortList(List<int> list){

     for (int i = 1; i < list.Count;i++ ){

           for (int j = 0; j < list.Count-i;j++ ){

                    int temp = 0;

                    if (list[j] > list[j+1])

                    {

                        temp = list[j];

                        list[j] = list[j+1];

                        list[j+1] = temp;

                    }

                }

            }

     return list;

 }

 

115.进位取整

Math.Ceiling();

 

2011-5-19

116.gridview行颜色设置

void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e){

    DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

  if (e.RowHandle >= 0){

       string qty_need = view.GetRowCellDisplayText(e.RowHandle, view.Columns["qty_need"]);

       string qty_adv = view.GetRowCellDisplayText(e.RowHandle, view.Columns["qty_adv"]);

if (Convert.ToDecimal(qty_need) == Convert.ToDecimal(qty_adv)){

       e.Appearance.BackColor = System.Drawing.Color.PaleTurquoise;

    }

  }

}

 

117.字符串以什么字母开头

dr["itemno"].ToString().StartsWith("YA")

 

2011-5-27

118.sql查询字段合并

SELECT A.prdsort,A.prdname,B.itemno,'('+B.itemno+')'+B.itemname as itemname ,C.bomtype

 

119.sql except 字段用法

select orderid from ec_ordersdtl

except

select orderid from ec_ordersmst

 

2011-6-3

120.panel里textbox控件获得焦点

this.ActiveControl = this.ngTextEdit5;

this.ngTextEdit5.Focus();

 

2011-7-7

121.递归实现排序插入

if (_dtlist.Rows.Count > 0 && dtlist.Rows[0]["itemno"].ToString() == "J"){

        DataTable dtCopy = _dtlist.Copy();

        _dtlist.Clear();

        _dtlist.ImportRow(dtCopy.Rows[0]);

 

DataRow[] rows = dtCopy.Select("reflineid = 1");

        for (int i = 0; i < rows.Length; i ++ ){

                _dtlist.ImportRow(rows[i]);

                _dtlist = InsertRow(_dtlist, dtCopy, (int)rows[i]["lineid"]);

         }

  }

 

public DataTable InsertRow(DataTable _dtlist, DataTable dtCopy, int reflineid){

        DataRow[] drs = dtCopy.Select("reflineid = " + reflineid + "");

        if (drs.Length > 0){

           foreach (DataRow dr in drs){

                 _dtlist.ImportRow(dr);

                 InsertRow(_dtlist, dtCopy, (int)dr["lineid"]);递归实现

            }

        }

        return _dtlist;

}

 

2011-7-11

122.数据库删除日志语句

--分部执行

--//将数据库设为简单模式

use ng0008

alter database ng0008

set recovery simple

go

 

--//查出name

select name from sysfiles where groupid=0

 

--//收缩日志

DBCC shrinkfile('NG0011_log',2)

 

--//将数据库改回模式

alter database ng0008

set recovery full

go