当前位置:编程学习 > C#/ASP.NET >>

找不到isam(vs2005中,操作excel时出现)!

 try
        {
            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=G:\\Visual Studio 2005\\new.xls;Extended Properties=Excel 8.0;");
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            //add two records to the table named 'MyTable'
            OleDbCommand objCmd = new OleDbCommand();
            objCmd.Connection = conn;
            objCmd.CommandText = "insert into MyTalbe (FirstName,LastName) values ('1','2')";
            objCmd.ExecuteNonQuery();
            objCmd.CommandText = "insert into MyTable(FirstName,LastName) values ('一','二')";
            objCmd.ExecuteNonQuery();
            //close the connection
            conn.Close();
        }
        catch (Exception ex)
        {

            Response.Write(ex.Message.ToString());
                    }


        
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,