我寫了一個在網絡中工作的Windows基本程序。試圖讀取或寫入受保護的內存。這通常表明其他內存已損壞
首先,我有一個自動完成文本框,它正在讀取數據庫中的名稱,並根據它們輸入的字母向用戶顯示。
程序工作正常但是它有時有這樣的錯誤
但
現在我已經添加了另一個自動完成文本框從數據庫中讀取,現在的第一自動完成正常工作,但是當我想填補第二文本框它顯示此錯誤並凍結。
有趣的是,該程序在服務器上正常工作,只在客戶端顯示此錯誤。 即使它沒有任何錯誤,當我在我的筆記本電腦上執行它或其他筆記本電腦時,我使用我的筆記本電腦在家中與他們建立了網絡,但它只在辦公室的客戶端計算機上出現錯誤。
請幫我解決這個問題。
謝謝
充分例外內容是:
-----Exception Type Is : UnHandled
-----Exceptiotn Message is : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
-----Source that causes this error: System.Windows.Forms
-----StackTrace is : at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Project1.Program.Main() in C:\Users\ZY\Documents\Visual Studio 2008\Projects\Project1\Project1\Program.cs:line 25
我自動完成代碼:
private void txtkhrdsharh_TextChanged(object sender, EventArgs e)
{
AutoCompleteStringCollection namecollection = new AutoCompleteStringCollection();
BLL objbll = new BLL();
SqlDataReader rea = objbll.SelectSharhlistF(txtkhrdsharh.Text);
if (rea.HasRows == true)
{
while (rea.Read())
namecollection.Add(rea["sharh"].ToString());
}
rea.Close();
txtkhrdsharh.AutoCompleteMode = AutoCompleteMode.Suggest;
txtkhrdsharh.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtkhrdsharh.AutoCompleteCustomSource = namecollection;
}
調用所有的心理調試...... – spender
「它凍結」?要麼沒有足夠的硬件,要麼你在撒謊。 –
發生未處理的異常,出現異常對話框,程序死機...非常確定這是什麼意思 –