Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > .NET Framework > Forum > Error Execl : Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY)



 

Error Execl : Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY)

 



Topic : 084973



โพสกระทู้ ( 52 )
บทความ ( 0 )



สถานะออฟไลน์




รบกวนช่วยด้วยค่ะ export excel file พบ error แบบนี้ค่ะ
จะเป็นเฉพาะกรณีมี record มาก ๆ เท่านั้นค่ะ

Code
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Range'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020846-0000-0000-C000-000000000046}' failed due to the following error: Not enough storage is available to complete this operation. (Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY)).


ขอบคุณค่ะ



Tag : .NET, Ms SQL Server 2005, Web (ASP.NET)









ประวัติการแก้ไข
2012-10-04 16:34:01
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-10-04 16:33:11 By : alonewin View : 3528 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

คุณเขียน Code ยังไงบ้างครับ ในตัวอย่างของ ไทยครีเอทหรือเปล่าครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-10-04 16:46:29 By : mr.win
 


 

No. 2

Guest


Code (VB.NET)
                    Dim excel As New Microsoft.Office.Interop.Excel.ApplicationClass()
                    Dim xBk As Microsoft.Office.Interop.Excel._Workbook
                    Dim xSt As Microsoft.Office.Interop.Excel._Worksheet

                    xBk = excel.Application.Workbooks.Add(True)
                    xSt = xBk.ActiveSheet

                    Dim ColumnIndex As Int64 = 0
                    Dim DT As DataTable
                    DT = CType(ViewState("gvListOutput"), DataTable)

                    ' DT.Columns.RemoveAt(0)

                    For Each dc As DataColumn In DT.Columns
                        ColumnIndex = ColumnIndex + 1
                        excel.Cells(1, ColumnIndex) = dc.ColumnName
                    Next

                    Dim rowIndex As Int64 = 0
                    For Each dr As DataRow In DT.Rows
                        rowIndex = rowIndex + 1
                        ColumnIndex = 0
                        For Each dc As DataColumn In DT.Columns
                            ColumnIndex = ColumnIndex + 1
                            excel.Cells(rowIndex + 1, ColumnIndex) = dr(dc.ColumnName)
                        Next
                    Next

                    If System.IO.File.Exists(path) Then System.IO.File.Delete(path)

                    xBk.SaveAs(path, Microsoft.Office.Interop.Excel.XlFileFormat.xlCSV)
                    xBk.Close(SaveChanges:=False)

                    excel.Quit()
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(excel)
                    GC.SuppressFinalize(excel)
                    GC.Collect()
                    xSt = Nothing
                    xBk = Nothing
                    excel = Nothing

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-10-05 08:20:10 By : alonewin
 

 

No. 3



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ลองเปลี่ยนไปใช้ Library ตัวอื่นดูครับ

Code (C#)
//Create the data set and table
DataSet ds = new DataSet("New_DataSet");
DataTable dt = new DataTable("New_DataTable");

//Set the locale for each
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
dt.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;

//Open a DB connection (in this example with OleDB)
OleDbConnection con = new OleDbConnection(dbConnectionString);
con.Open();

//Create a query and fill the data table with the data from the DB
string sql = "SELECT Whatever FROM MyDBTable;";
OleDbCommand cmd = new OleDbCommand(sql, con);
OleDbDataAdapter adptr = new OleDbDataAdapter();

adptr.SelectCommand = cmd;
adptr.Fill(dt);
con.Close();

//Add the table to the data set
ds.Tables.Add(dt);

//Here's the easy part. Create the Excel worksheet from the data set
ExcelLibrary.DataSetHelper.CreateWorkbook("MyExcelFile.xls", ds);


http://code.google.com/p/excellibrary/

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-10-05 08:54:20 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : Error Execl : Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY)
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่