asp.net c# connect excel to website?

คือผมต้องการต้องการเอาข้อมูลจาก excel มาเขียนบนเว็บครับ มือไหม่ ไม่รุ้ว่าผมมาถูกทางรึเปล่าครับตามโคดนี้ สมมติว่า จะเอาข้อมูลมาจาก excel file ช่อง a1 sheet1 มาเขียนใน label1
string path = string.Concat(Server.MapPath("~/Uploaded Folder/" + 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();
            // Create DbDataReader to Data Worksheet
            DbDataReader dr = command.ExecuteReader();

รบกวนด้วยครับ ขอบบคุนคับ
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่