using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.OleDb;
using System.Data.Odbc;
using System.Data.OracleClient;
//using System.OracleBulkCopy;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
// try
{
string path = string.Concat(("c:\\" + FileUpload1.FileName));
FileUpload1.SaveAs(path);
string excelConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=Excel 8.0", path);
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = excelConnectionString;
OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
connection.Open();
DbDataReader dr = command.ExecuteReader();
OracleConnection con = new OracleConnection (@"Data Source=test1;User ID=TEST;Password=RAM");
OracelBulkCopy bulkInsert = new OracelBulkCopy(con);
bulkInsert.DestinationTableName = "emp1";
bulkInsert.WriteToServer(dr);
Label1.Text = "task over";
}
// catch(Exception ex)
{
// Label1.Text = ex.Message;
}
}
}
}
收到错误错误
1找不到类型或命名空间名称'OracelBulkCopy'(您是否缺少using指令或程序集引用?)
帮我解决这个问题。 提前谢谢