If you write an SQL Server ce ApplicationProgramThe following error message is displayed:
Error code: 8007000e
Message: not enough storage is available to complete this operation.
Minor err.: 0 Source: Microsoft SQL Server 2000 Windows CE Edition
Or
Error code: 8007000e
Message: there is not enough storage space to complete this operation.
Minor err.: 0 Source: Microsoft SQL Server 2000 Windows CE Edition
This may be due to the following reasons:
After you fill in the dataset with the sqlcedataadapter object, the dispose method of the related sqlcecommand object is not explicitly called.
Solution:
After using the sqlcedataadapter object, call the dispose method of the sqlcecommand object related to the sqlcedataadapter object explicitly. Including selectcommand, insertcommand, updatecommand, and deletecommand.
ExampleCode:
Public Static Dataset loaddata ()
{
String Sqlstring = "" ;
// Make the connection to the SQL Server CE data source
Sqlceconnection Conn = New Sqlceconnection ( " Data Source = <completepath of SDF File> " );
// Create the sqlcedataadapter object
Sqlcedataadapter da = New Sqlcedataadapter ();
// Create the DataSet object
Dataset DS = New Dataset ();
try
{< br> sqlstring = " select name from mytable where name =? " ;
//Create the selectcommand instance to run a SELECT query
Da. selectcommand= NewSqlcecommand ();
// Set selectcommand object properties
Da. selectcommand. Connection = Conn;
Da. selectcommand. commandtext = Sqlstring;
Da. selectcommand. Parameters. Add ( New Sqlceparameter ( " Name " , System. Data. sqldbtype. nvarchar, 30 ));
Da. selectcommand. Parameters [ " Name " ]. Value = Name;
// Populate the DataSet object
Da. Fill (DS, " Name " );
}
Catch (Sqlceexception sqlx)
{
Showerrors (sqlx );
}
Catch (Exception X)
{
MessageBox. Show (X. Message. tostring ());
}
Finally
{
// Explicitly dispose the selectcommand instance
Da. selectcommand. Dispose ();
Da. Dispose ();
}
ReturnDS;
}
Refer to Microsoft Knowledge Base:
Sqlcecommand objects are not automatically disposed if you use a sqlcedataadapter object