using System;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
System.Data.DataTable table = new DataTable();
//計算常量,可以沒有初始化列
object test = table.Compute("1+1", "");
Console.WriteLine(test);
//test=2;
test = table.Compute("1+1", "false");
Console.WriteLine(test);
//test=2;常數計算和filter無關
test = table.Compute("abs(1)", "");
Console.WriteLine(test);
//test=null,不知道為這個什麼沒有抱錯,而且返回null,其他的數學函數都會抱錯
test = table.Compute("2%2", "");
Console.WriteLine(test);
//test=0;
//其他函數參考下面的計算列
//初始化datatale
table.Columns.Add("id", typeof(string));
table.Columns.Add("value", typeof(int));
for (int i = 1; i <= 10; i++)
{
System