SQL Server Ce: insufficient storage space for this operation [code: 8007000e]

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.