C#可以通过oledb操作 excel生成超链接 吗? 有的话,提供下代码,谢谢!

一般都是通过 Com组件,但是这种方法需要安装office组件,很不方便

第1个回答  2016-06-05
string strConn = "Provider=Microsoft.Ace.OleDb.12.0;Persist Security
Info=False;" + "data source=" + @excelPath + ";Extended
Properties='Excel 12.0; HDR=yes; IMEX=2'";
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = strConn;
try
{
OleDbCommand cmd = null;
try
{
cmd = new OleDbCommand("在这里写Update的SQL语句", conn);//(A,B,C,D,E,F,G)
cmd.ExecuteNonQuery();
}
catch (System.Exception ex)
{
textBox1.Text += ( ex.Message);
textBox1.Text += ("\r\n");
}本回答被网友采纳
相似回答