我在运行时创建了gridview,并在运行时创建了附加的数据源。创建新列并在该列上分配未绑定表达式。当我运行这个我只有空列。帮我解决这个问题。 这是我的代码
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT InvoiceId, InvoiceNumber, InvoiceDate, Customername AS CustomerId, (Select CustomerName from Customer where Customer.CustomerId = NewInvoice_1.CustomerName) AS Customer_Name, Tax, GrandTotal, CompanyId, InvoiceStatus FROM NewInvoice_1 WHERE CompanyId=" + TXE_CompId.Text + " ", connection);
DataSet sourceDataSet = new DataSet();
adapter.Fill(sourceDataSet);
gridControl1.DataSource = sourceDataSet.Tables[0];
gridView1.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn()
{
Caption = "Total",
FieldName = "Total",
VisibleIndex= 3 ,
UnboundType = DevExpress.Data.UnboundColumnType.Decimal,
UnboundExpression = "Round([GrandTotal] - [Tax]), 2)"
});
这是我的输出屏幕
答案 0 :(得分:2)