请问有没有可能为DataColumn.Expression属性添加的表达式中自定义处理函数(像IIF函数一样)。该如何何做?
解决方案 »
- 关于《视频和电子书下载》
- CAD图形重绘出来的问题
- 关于系统内消息的提醒怎么做?高手给个建议!
- 新手的简单问题,有经验的帮下忙
- 哪位大哥知道窗体怎么样自动伸缩 在线等 。。。。。。
- 有关c#datalist控件的一些问题
- 包含dateTimePicker控件的SQL语句为什么查不到数据呢(Acess2000)?
- 关于用户自定义控件的问题,请各位大侠帮忙!
- 偶想用一个DataSet来绑定多个comboBox,每个comboBox中的数据表不同,这样能实现嘛?
- 请问一个static的静态方法支持多线程吗???(在线等)
- 我想做个收费系统,是用.net做好呢还是用delphi做好?
- 在.net的移动Web开发里面怎么没有象以前 ASP里面的Session全局变量呢?
private void CalcColumns(){
DataColumn cPrice;
DataColumn cTax;
DataColumn cTotal;
DataTable myTable = new DataTable ();
// Create the first column.
cPrice = new DataColumn();
cPrice.DataType = System.Type.GetType("System.Decimal");
cPrice.ColumnName = "price";
cPrice.DefaultValue = 50;
// Create the second, calculated, column.
cTax = new DataColumn();
cTax.DataType = System.Type.GetType("System.Decimal");
cTax.ColumnName = "tax";
cTax.Expression = "price * 0.0862";
// Create third column.
cTotal = new DataColumn();
cTotal.DataType = System.Type.GetType("System.Decimal");
cTotal.ColumnName = "total";
cTotal.Expression = "price + tax";
// Add columns to DataTable.
myTable.Columns.Add(cPrice);
myTable.Columns.Add(cTax);
myTable.Columns.Add(cTotal);
DataRow myRow;
myRow = myTable.NewRow();
myTable.Rows.Add(myRow);
DataView myView = new DataView(myTable);
dataGrid1.DataSource = myView;
}
就是自己实现类似上面的函数,然后可以在DataColumn表达式中这样写:
DataColumn.Expression = " 自定义函数(cPrice*cTax)"