 |
|
รบกวนถาม error หน่อยค่ะ แสดงกราฟไม่ได้ คือต้องการแสดงการสรุปข้อมูลเป็นกราฟบนหน้าเวบน่ะค่ะ |
|
 |
|
|
 |
 |
|
ขอดู Source Code ทั้งหมดหน่อยครับ
|
 |
 |
 |
 |
Date :
21 ส.ค. 2549 16:43:08 |
By :
Ton |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<% @ Language="VBScript" %>
<%
Response.Buffer=True
Response.Clear
Dim xlApp,xlBook,xlSheet,objConn,objRS,iRow
Dim objFileCache,bXlsFile,strFileName
iRow = 4
strFileName = "MyChart.xls"
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & Server.MapPath("Sales00.mdb")
strQuery = "SELECT ProductName,ProductIncome FROM ProductSales"
objConn.Open strConn
objRS.Open strQuery, objConn
If Not objRS.EOF and Not objRS.BOF Then
arrData = objRS.GetRows()
Else
bNoRecords = True
End If
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
'-------------------------------- END of DATA Acquisition---------------------
'-------------------------------- BEGIN XLS Generation -----------------------
strFileName = "MyChart.xls"
Set xlApp = Server.CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlApp.Application.Visible = False
xlBook.Sheets.Add
xlBook.ActiveSheet.Name = "Data"
With xlBook.Sheets("Data").Cells(1,1)
.Value = "Overall Product Sales 2000"
.Font.Bold = True
.Font.Name = "Tahoma"
.Font.Size = 16
End With
With xlBook.Sheets("Data").Cells(3,1)
.Value = "Product Name"
.Font.Italic = True
.Font.Name = "Tahoma"
.Font.Size = 13
.MergeCells = True
End With
With xlBook.Sheets("Data").Cells(3,2)
.Value = "Product Income"
.Font.Italic = True
.Font.Name = "Tahoma"
.Font.Size = 13
.MergeCells = True
End With
For i = 0 To Ubound(arrData,2)
xlBook.Sheets("Data").Cells(iRow+i,1).Value = arrData(0,i)
xlBook.Sheets("Data").Cells(iRow+i,2).Value = arrData(1,i)
xlBook.Sheets("Data").Cells(iRow+i,2).NumberFormat = "$#,##0.00"
Next
'--- Creating Chart
xlBook.Charts.Add
xlBook.ActiveChart.Name = "BarGraph"
xlBook.Charts("BarGraph").SetSourceData (xlBook.Sheets("Data").Range("A4:B9"))
'--- 3DPieExploded
'xlBook.Charts("BarGraph").ChartType = 70
'xlBook.Charts("BarGraph").PlotBy = 2
'--- 3DColumns
xlBook.Charts("BarGraph").ChartType = 54
xlBook.Charts("BarGraph").PlotBy = 1
xlBook.Charts("BarGraph").HasAxis(1) = 0
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(Server.MapPath(strFileName))) Then
Set MyFile = fso.GetFile(Server.MapPath(strFileName))
MyFile.Delete
End If
xlSheet.SaveAs Server.MapPath(strFileName)
xlApp.Application.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Set objFileCache = Server.CreateObject("Softwing.FileCache.1")
bXlsFile = objFileCache.InitFromFile(strFileName, False)
objFileCache.MimeType = "application/octet-stream"
bXlsFile = objFileCache.Write()
Response.End
%>
อันนี้ก็โหลดมาอะค่ะ รบกวนช่วยดูหน่อยนะคะ ไม่รู้ว่าต้องตั้งค่าอะไรเพิ่มหรือป่าว ขอบคุณมากค่ะ
|
 |
 |
 |
 |
Date :
21 ส.ค. 2549 17:32:53 |
By :
มือใหม่ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
http://support.microsoft.com/kb/259725
แก้ตามนี้นะครับ
Windows XP
a. Start COM+ Explorer. On the Start menu, click Admin Tools, and then click Component Services.
b. Click to expand Component Services, click to expand Computers, click to expand My Computer, and then click to expand DCOM Config.
c. Right-click VB ASP Debugging, and the click Properties.
d. On the Securities tab, under Access Permissions, select Customize, and then click Edit.
e. In the Access Permission window, click Add, and then add the Everyone account for Allow Access option.
f. Click OK, click Apply, and then click OK to apply the changes and exit the DCOM Configuration properties page.
g. Restart the computer so that the changes take effect.
|
 |
 |
 |
 |
Date :
21 ส.ค. 2549 17:45:58 |
By :
@W_IN |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองแก้ดูแล้วก็ยังติด error เหมือนเดิมค่ะ มีวิธีอื่น หรือ code อย่างอื่นไหมค่ะ
|
 |
 |
 |
 |
Date :
15 พ.ย. 2549 18:34:15 |
By :
ภา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|