Re: Is it just me or are there BIG problems with SQLCE 3.0?
- From: An o' Neamus <oneamus@xxxxxxxxx>
- Date: Tue, 09 Oct 2007 00:55:26 -0700
On Oct 8, 8:00 pm, "William Vaughn" <billvaNoS...@xxxxxxxxx> wrote:
I encourage you to get up on MSDN Connect and start pounding on the SQL CE
3.0 team to help them repro the performance and crash cases you have
experienced. I have passed your comments to the dev team directly but did
not get much more than "It seems to run faster for us...". Since they have
not shipped I think it would make sense for everyone to get these issues
resolved.
Thanks. I've sent a message to the team through their blog as was
requested on the forums.microsoft SQLCE forum. What is MSDN Connect,
and how do I use this to 'pound' the SQL team? :)
I'm including a simplified example below for reference. Please note
that the content of the example is not that important, this same test
has been done with parameterised SQL, SqlCeRecordset and C++/OLE DB.
It *always* fails at exactly the same point (ie. 25592 records), and
never fails on SQLCE 2.0 (obviously the SqlCeRecordset test could not
be done on SQLCE 2.0). As suggested by another poster, I've added a
bit of code into my test which closes and reopens the database
connection after 10000 inserts. This does solve the problem on SQLCE
3.0 (with all of the above access methods). However, I've read that
opening and closing the DB connection is not a good idea. Will this
introduce any additional problems, and if so, what are they?
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 ))
{
Console.WriteLine("Creating database: " +
strDatabase);
// Create SQL engine object
SqlCeEngine sqlEngine = new SqlCeEngine(
sqlConnection.ConnectionString);
// 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();
}
}
}
.
- Follow-Ups:
- Re: Is it just me or are there BIG problems with SQLCE 3.0?
- From: William Vaughn
- Re: Is it just me or are there BIG problems with SQLCE 3.0?
- References:
- Is it just me or are there BIG problems with SQLCE 3.0?
- From: An o' Neamus
- Re: Is it just me or are there BIG problems with SQLCE 3.0?
- From: William Vaughn
- Re: Is it just me or are there BIG problems with SQLCE 3.0?
- From: An o' Neamus
- Re: Is it just me or are there BIG problems with SQLCE 3.0?
- From: William Vaughn
- Is it just me or are there BIG problems with SQLCE 3.0?
- Prev by Date: Re: Is it just me or are there BIG problems with SQLCE 3.0?
- Next by Date: Re: Is it just me or are there BIG problems with SQLCE 3.0?
- Previous by thread: Re: Is it just me or are there BIG problems with SQLCE 3.0?
- Next by thread: Re: Is it just me or are there BIG problems with SQLCE 3.0?
- Index(es):
Relevant Pages
|