2010-12-10
100.Oracle排序分页:
SELECT * From
(
Select Rownum rn,t.* From
(
SELECT con_contract.con_systemcode, contype, subtype, concode, contractname, hostcode, fccode, exchrate, initsum, initsum_fc, approvesum, approvesum_fc, costsum, costsum_fc, briefing, constatus, uocode, createuser, createdate, approveuser, approvedate, archivesuser, commissioner, pri, inceptdate, deadlinedate, handover, historyflag, coopstatus, opposingunit, balanceunit, affixtounit, affixtoaddress, affixtodate, con_contract.update_datetime, employeeno, systemid,con_contract.vary_num,vary_cause,vary_note,vary_man,varyischeck,vary_datetime,varycheck_dt,varycheck_man,catalogcode,varywithapp,balance_ocode,con_contract.linkconsystemcode,0 selected
FROM ng0004.con_contract,ng0004.uv_con_baseinfo
where con_contract.con_systemcode = uv_con_baseinfo.con_systemcode
and (historyflag=0 or historyflag is null or (historyflag=1 and (handover =1)))
order by con_contract.createdate desc
) t
Where Rownum <= '500'
)
Where rn > '400'
2010-12-27
101.DataTable访问删除的行
if (varRow.RowState == DataRowState.Deleted)
{
stringhostcode=varRow["hostcode",
DataRowVersion.Original].ToString();
stringcontentcode=varRow["content_code"
,DataRowVersion.Original].ToString();
}
2011-1-7
102.TreeView 查找节点并选中
if (this.dataConSerachControl1.ngGroupBy.EditValue == DBNull.Value ||
this.dataConSerachControl1.ngGroupBy.EditValue == null) return;
string serachText = this.dataConSerachControl1.ngText.Text.Trim();
DataRow[] drs = ds.Tables["dt1"].Select("con_systemcode = '"+serachText+"'");
if(drs.Length > 0)
{
TreeNode node = new TreeNode();
node.Tag = serachText;
node.Text = serachText + "|" + drs[0]["contractname"].ToString();
node.Name = serachText + "|" + drs[0]["contractname"].ToString();
TreeNode[] nodes = this.ngTree.Nodes.Find(node.Name,true);
if (nodes.Length > 0)
{
this.ngTree.SelectedNode = nodes[0];
this.ngTree.Focus();
或者
this.SourceTreeView.SelectNode(nodes[0]);
}
}
103.树添加节点
if (SourceTreeView.SelectedNodes == null)
{
MessageBox.Show(this, Res.qxzzbsdhtxx, Res.DataEntityForInfoChose_Cue, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
for (int i = 0; i < SourceTreeView.SelectedNodes.Count; i++)
{
TreeNode node = this.SourceTreeView.SelectedNodes[i] as TreeNode;
if (node.Level == 0) return;//一级结点不用拷贝
TreeNode pnode = node.Parent.Clone() as TreeNode;//父节点
TreeNode tempnode = node.Clone() as TreeNode;
TreeNode[] nodes = this.IndividualTreeView.Nodes.Find(node.Name, true);
if (nodes.Length > 0)
{
MessageBox.Show(String.Format(Res.TreeIndividualForm_DotIs, tempnode.Text)); //"节点["+ tempnode.Text + "]已存在"
continue; //结点已经存在
}
TreeNode[] parentnodes;
if (node.Level == 3)
{
parentnodes = this.IndividualTreeView.Nodes.Find(node.Parent.Parent.Name, true); //寻找父节点的父节点
}
else
{
parentnodes = this.IndividualTreeView.Nodes.Find(node.Parent.Name, true); //寻找父节点
}
if (parentnodes.Length > 0)
{
if (node.Level == 3)
{
TreeNode[] pparentnodes = this.IndividualTreeView.Nodes.Find(node.Parent.Name, true); //寻找父节点
if (pparentnodes.Length > 0)
{
pparentnodes[0].Nodes.Add(tempnode);//挂载到父节点下面
}
else
{
pnode.Nodes.Clear();
pnode.Nodes.Add(tempnode);
parentnodes[0].Nodes.Add(pnode);
}
}
else
{
parentnodes[0].Nodes.Add(tempnode);//挂载到父节点下面
}
}
else
{
//顺带把父节点也加过来
//if (tempnode.Nodes.Count == 0 && pnode.Tag.ToString() != "root")
if (pnode.Tag.ToString() != "root")
{
if (node.Level == 3)
{
TreeNode ppnode = node.Parent.Parent.Clone() as TreeNode;
ppnode.Nodes.Clear();
ppnode.Nodes.Add(pnode);
pnode.Nodes.Clear();
pnode.Nodes.Add(tempnode);
this.IndividualTreeView.Nodes[0].Nodes.Add(ppnode);
}
else
{
pnode.Nodes.Clear();
pnode.Nodes.Add(tempnode);
this.IndividualTreeView.Nodes[0].Nodes.Add(pnode);
}
}
else
{
this.IndividualTreeView.Nodes[0].Nodes.Add(tempnode);
}
}
this.IndividualTreeView.SelectNode(tempnode);
//this.IndividualTreeView.SelectNode(this.IndividualTreeView.Nodes[0]);
}
isChanged = true;
this.IndividualTreeView.ExpandAll();
104.Lookupedit控件绑定数据字段类型
DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(int));注意类型 不然可能赋值不上
dt.Columns.Add("name", typeof(string));
2011-1-21
106.获取上一级目录
filePath = AppDomain.CurrentDomain.BaseDirectory + "..//dbcnt//funcimport.txt";
107.读取.txt文件
string filePath = string.Empty;
string sLine = string.Empty;
StreamReader sr = null;
filePath = AppDomain.CurrentDomain.BaseDirectory + "..//dbcnt//funcimport.txt";
sr = new StreamReader(filePath, Encoding.Default);
while (sLine != null)
{
sLine = sr.ReadLine();
if (!string.IsNullOrEmpty(sLine))
{
string[] sLines = sLine.Split('/t');
}
}
2011-2-10
108. Sqlserver 与 oracle update…from..用法
Sqlserver:
update con_productbill set con_productbill.vary_num = con_contract.vary_num
from con_contract,con_productbill
where con_contract.vary_num > 0 and con_contract.con_systemcode = con_productbill.con_systemcode and con_productbill.vary_num is null
oracle:
Update Con_Productbill
Set Con_Productbill.Vary_Num = (
Select Con_Contract.vary_num
From Con_Contract
Where Con_Contract.Vary_Num > 0 And Con_Contract.Con_Systemcode = Con_Productbill.Con_Systemcode And
(Con_Productbill.Vary_Num Is Null Or Con_Productbill.vary_num = 0)
)
Where Con_Productbill.Vary_Num Is Null Or Con_Productbill.Vary_Num = 0
2011-2-24
109.树结点key,value用法
string key1 = dr["node1_tag"].ToString();
string value1 = dr["node1_text"].ToString();
if (!treeView.Nodes[0].Nodes.ContainsKey(key1))
{
treeView.Nodes[0].Nodes.Add(key1, value1).Tag = key1;
}
string key2 = dr["node2_tag"].ToString();
string value2 = dr["node2_text"].ToString();
if (!treeView.Nodes[0].Nodes[key1].Nodes.ContainsKey(key2))
{
treeView.Nodes[0].Nodes[key1].Nodes.Add(key2, value2).Tag = key2;
}
110.委托回调简用
public delegate void SaveEventHandler(string text);
子窗:
public SaveEventHandler save;
if (save != null)
save(this.proidDrop.EditValue.ToString());
父窗:
SaveEventHandler hander = new SaveEventHandler(OnNumberChanged);
frm.save = hander;
public void OnNumberChanged(string text)
{
this.proidDrop.EditValue = text;
}