2014-01-29 3 views
0

Windows Mobile 6.5 장치에 스캐너 응용 프로그램이 있습니다.SqlCeException 저장소가 부족합니다.

100 개 항목 (예 : SqlCe Connection을 열고 SQL 쿼리를 실행하여 임시 DataTable에 쿼리 결과를 채우는 위치)을 스캔하면 응용 프로그램이 계속 충돌합니다. 여기

내 C# 코드의 모양 방법 : 인 충돌에

// Search with SQL 
modFunctions.tempItemTable = new AppScanDataSet.itemDataTable(); 
string connectionString = @"Data Source='" + modFunctions.AppPath() + "AppScan.sdf'; Max Database Size = 512; Max Buffer Size = 4096;"; 
string strSql = "SELECT * FROM item WHERE Barcode = '" + modFunctions.strBarcode + "'"; 

using (SqlCeConnection mConnection = new SqlCeConnection(connectionString)) 
{ 
    mConnection.Open(); 

    //SqlCeConnection mConnection = new SqlCeConnection(connectionString); 
    SqlCeCommand mCommand = new SqlCeCommand(strSql, mConnection); 

    // Read all rows from the table into a dataset (note, the adapter automatically opens connection) 
    SqlCeDataAdapter adapter = new SqlCeDataAdapter(mCommand); 
    adapter.Fill(modFunctions.tempItemTable); 

    mConnection.Close(); 
    mConnection.Dispose(); 
} 

오류 :

AppScan.exe 
SqlCeException 
Not enough storage is available to complete this operation 

무슨 문제가 될 수있다? tempItemTable (Dispose()Clear())을 삭제합니다. 또한 mConnection.Close()mConnection.Dispose()을 추가했지만 도움이되지 않았습니다.

또한 설정> 시스템> 메모리 ..로 갈 때 응용 프로그램이 다운되면 100MB 중에서 30MB 정도의 메모리를 사용할 수있는 것 같습니다.

adapter을 처분해야합니까? 또는 mCommand?

+0

예외 (어떤 줄, 스택 추적, InnerException)에서 좀 더 자세한 정보를 얻으려고하십시오. 또한 바코드는 고유합니까? 테이블에 큰 BLOB 열이 있습니까? –

+0

AppScan.sdf 파일의 크기는 얼마입니까? –

답변

2

메모리가 부족합니다. Windows Mobile에서 DataSet을 사용하는 것은 권장되지 않으며 대신 배열 또는 목록을 사용하십시오.