麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > Delphi > 正文

delphi2005探討之四

2019-11-18 18:03:17
字體:
來源:轉載
供稿:網友
 

筆者在用delphi2005調試其自帶例子的DBWebFilterSample時遇到以下問題:若BdpDataAdapter1的active屬性設為true,編譯運行出現以下錯

“/DBWebFilterSample”應用程序中的服務器錯誤。
--------------------------------------------------------------------------------
Connection open failed. unavailable database
說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆棧跟蹤信息,以了解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。
異常詳細信息: Borland.Data.Common.BdpException: Connection open failed. unavailable database源錯誤: 行 288:
Self.DBWebDataSource1.ErrorDlgForeColor := System.Drawing.Color.Black;行 289:  Include(Self.Load, Self.Page_Load);行 290:
(System.ComponentModel.ISupportInitialize(Self.BdpDataAdapter1)).EndInit;行 291:
(System.ComponentModel.ISupportInitialize(Self.Employees)).EndInit;行 292:
(System.ComponentModel.ISupportInitialize(Self.DataTable1)).EndInit;

源文件: G:/PRogram Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas 行: 290 堆棧跟蹤: [BdpException:
Connection open failed. unavailable database]   Borland.Data.Provider.BdpDataAdapter.e() 
Borland.Data.Provider.BdpDataAdapter.EndInit()   WebForm1.TWebForm1.InitializeComponent() in G:/Program
Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas:290   WebForm1.TWebForm1.OnInit(EventArgs e) in
G:/Program Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas:344 
System.Web.UI.Control.InitRecursive(Control namingContainer)   System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; asp.net 版本:1.1.4322.573 若BdpDataAdapter1的Active

 

屬性設為false,出現以下錯誤:
“/DBWebFilterSample”應用程序中的服務器錯誤。
--------------------------------------------------------------------------------
輸入字符串的格式不正確。
說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆棧跟蹤信息,以了解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。
異常詳細信息: System.FormatException: 輸入字符串的格式不正確。源錯誤: 行 325:    else行 326:      sCurrentFilter :=
Convert.ToString(o);行 327:    StartCustId := Convert.ToInt16(ListBox1.SelectedValue);行 328:    EndCustId :=
Convert.ToInt16(ListBox2.SelectedValue);行 329:    if StartCustId < EndCustId then
源文件: G:/Program Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas 行: 327 堆棧跟蹤: [FormatException:
輸入字符串的格式不正確。]   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0 
System.Int16.Parse(String s, NumberStyles style, IFormatProvider provider) +37   System.Convert.ToInt16(String value) +19 
WebForm1.TWebForm1.Page_Load(Object sender, EventArgs e) in G:/Program
Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas:327   System.Web.UI.Control.OnLoad(EventArgs e) 
System.Web.UI.Control.LoadRecursive()   System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573


    由于我測試重點是用delphi2005實現web查詢,對以上小錯誤稍加修改,編譯運行不出現錯誤,但不顯示任何數據。為了讓其顯示數據,筆者自
行在webform1設計窗體加入一個按鈕,在按鈕事件中加入以下代碼:
if not BdpDataAdapter1.Active
thenBdpDataAdapter1.Active:=true;
編譯運行點擊此按鈕,出現以下錯誤:
“/DBWebFilterSample”應用程序中的服務器錯誤。
--------------------------------------------------------------------------------
Connection open failed. unavailable database
說明: 執行當前Web 請求期間,出現未處理的異常。請檢查堆棧跟蹤信息,以了解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。
異常詳細信息:
Borland.Data.Common.BdpException: Connection open failed. unavailable database源錯誤: 行 301:
if not BdpDataAdapter1.Active then行 303:
BdpDataAdapter1.Active:=true;//此句出錯行 304:
end;
源文件: G:/Program
Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas 行: 303
堆棧跟蹤: [BdpException: Connection open failed.
unavailable database] Borland.Data.Provider.BdpDataAdapter.e() Borland.Data.Provider.BdpDataAdapter.set_Active(Boolean value)
WebForm1.TWebForm1.Button1_Click(Object sender, EventArgs e) in G:/Program
Files/Borland/BDS/3.0/Demos/Delphi.Net/DBWeb/WebFilter/WebForm1.pas:303 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.ipostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573

    仔細查閱幫助文件,BdpDataAdapter1的Active屬性需設為true,但這么設置后也不行啊。肯定是數據庫連接有問題,但在設計狀態下測試數據
庫連接沒有問題呀,于是把重新在按鈕事件加入數據庫連接所有屬性,編譯運行,點擊,故障依舊。 再仔細查閱幫助文件,內有如下內容:To
To set up a connection
 
1.In Borland Data Provider: Connections Editor, select the appropriate item from the Connections list.
2.In Connection Settings, enter the Database path.
Note: If referring to a database on the local disk, prepend the path with
localhost:. If using Interbase, for example, you would enter the path to your Interbase database:
localhost:C:/Program Files/Borland/Interbase/Examples/Database/employee.gdb
(or whatever the actual path might be for your system).

3.Complete the UserName and PassWord fields for the database as needed.
4.Click Test to confirm the connection.
A dialog appears confirming the status of the connection.

5.Click OK to return to the Borland Data Provider: Connections Editor dialog.
6.Click OK to return to the Data Adapter Configuration dialog.
In the Command tab, the areas for Tables and Columns are updated with information from your connection.

于是把BdpConnection1的ConnectionString屬性設為databas=localhost:g:/Program
Files/Borland/Interbase/Examples/Database/employee.gdb;assembly=Borland.Data.Interbase,Version=2.0.0.0,Culture=neutral,Public
KeyToken=91d62ebb5b0d1b1b;vendorclient=gds32.dll;provider=Interbase;username=sysdba;password=masterkey
BdpDataAdapter1的Active屬性設為true

去掉所加按鈕及其代碼,再次編譯運行,一切正常。


上一篇:Delphi+MapX5中使用自定義字體符號

下一篇:在delphi7中利用mscomm控件編程

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 在线亚洲综合 | 欧美日韩免费观看视频 | 国产午夜精品一区二区三区嫩草 | 久久久久免费电影 | 男女无遮挡羞羞视频 | www.91视频com | 欧洲黄视频 | 成人性生活视频在线观看 | 欧洲精品视频在线观看 | 久久久久97国产精 | 国产视频在线一区 | 成年性羞羞视频免费观看 | 在线观看免费视频麻豆 | 黄在线看| 国产成人精品一区在线播放 | 伊人成人免费视频 | 日韩在线欧美在线 | 久久久久久久久久美女 | 国产99一区二区 | 欧美a视频 | 午夜精品成人 | 成人在线免费观看视频 | 欧美激情精品久久久久久久久久 | 黄色片网页 | 91九色福利| 午夜视频中文字幕 | 欧美一级高潮 | 久久国产精品久久精品国产演员表 | 永久久久 | 成人视屏在线 | 久久国产精品区 | 九九热视频在线免费观看 | 久久中文字幕在线观看 | 午夜视频在线观看免费视频 | 斗破苍穹在线观看免费完整观看 | 毛片118极品美女写真 | 日日做夜夜操 | 91美女视频在线观看 | 亚洲一二区精品 | 成人在线视频免费 | 一区二区视频在线看 |