提问人的追问   2010-09-20 10:11 我现在也明白了,修改表结构跟更新记录不是一个概念。现在我就想用数据库连接这种方法。不过执行SQL语句的时候还是遇到问题了。我把问题简化成只加一列。代码是这样的:using System;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace AddingColumn
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =" + @"c:\example.xls" + ";Extended Properties=Excel 8.0";
            OleDbConnection conn = new OleDbConnection(str);
            OleDbCommand cmd = new OleDbCommand("alter table [Sheet1$] add result int", conn);
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            Console.Read();
        }
    }
}运行之后依然有问题红色部分出错:无效的操作