前情提要:VB.NET 2005 程式 CrystalReportViewer 呈現 + Crystal Report 9 (以OLE DB 連至 MS SQL 的 Stoer proceduer 取得報表資料內容) + MS SQL 2000

真是怪了!

發現有些電腦在安裝執行我開發的程式,當開啟報表時會出現要輸入資料庫資訊的畫面(這些資訊有於程式中給予之),而且不管怎麼輸入都是出現輸入錯誤的訊息!!!

為什麼有些電腦可以正常執行(直接開啟報表檔案呈現結果),有些電腦卻出現這種鳥問題???

100222--6.jpg

害我花了好幾天比較可以正常執行跟不能正常執行的電腦之間到底是哪裡有不一樣? 更新版本? DB版本?.................

其出現的錯誤訊息為

100222--7.jpg  

詳細錯誤訊息內容是


************** Exception Text **************
System.Runtime.InteropServices.COMException (0x8004100F): Logon failed.
Details: ADO Error Code: 0x
Source: Provider
Description: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Native Error:
Error in File C:\DOCUME~1\WEBRAN~1\LOCALS~1\Temp\TestReport_11 {8D6C4923-237A-4DB8-BC60-3B5A466FEC86}.rpt:
Unable to connect: incorrect log on parameters.
   at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.SetTableLocation(ISCRTable CurTable, ISCRTable NewTable)
   at CrystalDecisions.CrystalReports.Engine.Table.set_Location(String value)
   at WINTRISS_Report.mdlComm.setReportDoc(ReportDocument ReportDoc)
   at WINTRISS_Report.frmAnaMainPage.Button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************

.................................................................(略)

上網查了半天好像是....開啟 ADO 連線時「多重步驟 OLE DB 操作發生錯誤」,也有人遇過此問題,但狀況都跟我不太一樣...甚至一度懷疑到 CPU 是 32 or 64 bit 的差別所導致,後來發現出問題的電腦它的OS都是 English XP 的,換言之,中文的 XP 就可以正常執行,But WHY ????????????????????

那幾天被這問題搞的"茶不思飯不想的"...再解決不出來....我看大概就要捲布蓋走人囉~

100222--8.jpg

最後發現在中文跟英文的OS下製作出來的報表,其 OLE DB 中的 Locale Identifier 不一樣,一時找不出來怎麼動態的更新報表連結的屬性值,就把原來的報表檔的 data source 改連接(原製作時是中文OS)到英文的OS後,其數值從1028(中文)變更為1033(英文),更新報表檔後在英文OS上執行就可正常呈現報表結果了,而且更新後的報表檔依舊可正常的在中文OS下執行,終於解決啦~

只是這 OLE DB 的屬性怎麼還會依國別做限制ㄚ!?那下次遇到簡體版or日韓文版的OS...不是又不能正常顯示了嗎? 應該不能限死ㄚ!?...還是我 Crystal Report 版本太舊了....

切~~~反正以後不要用 OLE DB 連了啦~

 

【參考】:

[Microsoft 技術支援] SQLOLEDB OLE DB 提供者的資訊: 初始化屬性

[Microsoft 技術支援] 開啟 ADO 連線時「多重步驟 OLE DB 操作發生錯誤」

[MicroSoftTechNet] OLE DB 初始化和授權屬性

[msdn] Locale IDs Assigned by Microsoft

[msdn] Locating Folders and Files (64-bit)

arrow
arrow
    全站熱搜

    tsuozoe 發表在 痞客邦 留言(1) 人氣()