Re: Native exception 0xc0000005 when using SQLCE and .NET CF 2.0?!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Try to check out this article by Joao Paulo Figueira entitled "SQL Compact
Edition Insert Performance"
http://www.pocketpcdn.com/articles/articles.php?&atb.set(c_id)=74&atb.set(a_id)=11003&atb.perform(details)

--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com


"An o' Neamus" <oneamus@xxxxxxxxx> wrote in message
news:1191341416.429752.200430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Greetings,

I have written a very basic C# console test app to check the
performance and reliability of SQLCE on Windows CE 5.0 (source code
below). Running this on different Windows CE 5.0 devices, I always get
a 0xc0000005 native exception error when reaching 25592 inserts. It
doesn't matter whether the database is empty or not when the test is
run, it always fails at that exact number of inserts. Given that I
would expect a managed application not to be able to generate native
exceptions anyway, and can't really see any reason why it would in
this case, I'm at a bit of a loss as to what's going wrong... Any
ideas?

Using:
VS2005 w/ SP1
Windows CE 5.0 (on custom SH4 platform and HTC WM5 smartphone)
.NET CF 2.0 w/ SP1 and post SP1 patch
SQLCE 3.0.3600.0

TIA

Source code:

using System.Data;
using System.Data.SqlServerCe;

namespace TestDB
{
class Program
{
static void Main(string[] args)
{
SqlCeConnection sqlConnection = new SqlCeConnection();
SqlCeCommand sqlCommand = sqlConnection.CreateCommand();
SqlCeResultSet sqlResult;

string strDatabase = "\\TestDB.sdf";
string strTable = "TestTable";

try
{
// Database connection string
sqlConnection.ConnectionString =
"Data Source=" + strDatabase;

// Database file doesn't exist?
if (!System.IO.File.Exists( strDatabase ))
{
// Create SQL engine object
SqlCeEngine sqlEngine = new SqlCeEngine(
sqlConnection.ConnectionString);

Console.WriteLine("Creating database: " +
strDatabase);

// Use it to create database
sqlEngine.CreateDatabase();
}

Console.WriteLine("Opening database: " + strDatabase);

// Open database connection
sqlConnection.Open();

// Display SQL version
Console.WriteLine("SQL Version: "
+ sqlConnection.ServerVersion.ToString());

// Check if table exists
sqlCommand.CommandText = "SELECT TABLE_NAME FROM "
+ "INFORMATION_SCHEMA.TABLES WHERE "
+ "TABLE_NAME = '" + strTable + "'";
sqlResult = sqlCommand.ExecuteResultSet(
ResultSetOptions.Insensitive);

// Table doesn't exist?
if (!sqlResult.Read())
{
Console.WriteLine("Creating table: " + strTable);

// Create table
sqlCommand.CommandText = "CREATE TABLE " +
strTable
+ "(Sequence integer IDENTITY(1,1) NOT NULL
PRIMARY KEY, "
+ "Timestamp datetime DEFAULT GETDATE(),"
+ "Message nvarchar(80))";
sqlCommand.ExecuteNonQuery();
}

string strText;

for (int i = 1; i <= 500000; i++)
{
Console.Write("\rInserted " + i.ToString() + "
records ");

strText = "Row Number: " + i.ToString();

sqlCommand.CommandText = "INSERT INTO " + strTable
+ " (Message) VALUES ('" + strText + "')";
sqlCommand.ExecuteNonQuery();
}
}
// SQL error
catch(SqlCeException sqlex)
{
// Display all error messages
Console.WriteLine( "ERROR:" );
foreach (SqlCeError sqlError in sqlex.Errors)
{
Console.WriteLine( sqlError );
}
}
// Other errors
catch(Exception ex)
{
// Display error message
Console.WriteLine( "ERROR:" );
Console.WriteLine( ex.Message );
}
finally
{
// Close connection
if (sqlConnection.State != ConnectionState.Closed)
{
Console.WriteLine("Closing database");

sqlConnection.Close();
}
}

Console.ReadLine();
}
}
}



.



Relevant Pages

  • Fixed
    ... I also found this article that gives the proper way to move system dbs in sql 2008: ... The model exists where the master states it exists. ... This is the error log prior to detaching the model database. ...
    (microsoft.public.sqlserver.server)
  • Re: CREATE AGGREGATE failed because type Concatenate does not conform to UDAGG specification due to
    ... Go to the Database tab and click on the browse button next to the connection string. ... In the New Database Reference dialog, enter the details for the database where you want to deploy the assembly and create the user defined aggregate. ... I'm trying to do some CLR integration with sql server 2005. ...
    (microsoft.public.sqlserver.programming)
  • CREATE AGGREGATE failed because type Concatenate does not conform to UDAGG specification due to meth
    ... Now register the assembly and the aggregate in the SQL Server database you want ... I'm trying to do some CLR integration with sql server 2005. ...
    (microsoft.public.sqlserver.programming)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: Querying a DataSet/DataTable in .NET
    ... to writing an in-memory database engine. ... >>>I think it would be nice if we could have a SQL engine available on the ... >>> display only (I could put it in business objects so I can reuse the ...
    (microsoft.public.dotnet.general)