[SQL] - Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 問題之解決
阿新 • • 發佈:2017-06-28
img png .com 異常 hresult image select att blog
場景:
使用 Oracle.DataAccess.dll 訪問數據庫時,OracleDataAdapter 執行失敗。
異常:
System.AccessViolationException was unhandled
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=Oracle.DataAccess
分析:
有問題的SQL
select distinct username from user u, role r where u.roleid = r.id and u.id = 1
正確的SQL
select distinct u.username from user u, role r where u.roleid = r.id and u.id = 1
總結:
規範使用 SQL 語法,指定表別名進行聯合查詢。
[SQL] - Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 問題之解決