RE: ldb file remains after closing connection

Tech-Archive recommends: Fix windows errors by optimizing your registry



It seems to happen with large transactions. I can repro this consistently
with the following:

private void button1_Click(object sender, EventArgs e)
{
string connectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Repro\Nwind.mdb";
using (OleDbConnection con = new
OleDbConnection(connectionString))
{
con.Open();
using (OleDbTransaction trans = con.BeginTransaction())
{
for (int i = 0; i < 1000; i++)
{
string name = Guid.NewGuid().ToString();
string description = Guid.NewGuid().ToString();
string sql = "INSERT INTO Categories (CategoryName,
Description) VALUES (@Name, @Description)";
OleDbCommand cmd = new OleDbCommand(sql, con, trans);
cmd.Parameters.AddWithValue("Name",
name.Substring(0, 15));
cmd.Parameters.AddWithValue("Description",
description);
cmd.ExecuteNonQuery();
}
trans.Commit();
}
con.Close();
}
}


""Walter Wang [MSFT]"" wrote:

Hi,

I've used following code to test and cannot reproduce the issue you
mentioned:

private OleDbConnection m_db;

private void button1_Click(object sender, EventArgs e)
{
m_db = new OleDbConnection();
m_db.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Program Files\Microsoft Visual Studio\VB98\BIBLIO.MDB;User
Id=admin;Password=;";
m_db.Open();

OleDbTransaction tx = m_db.BeginTransaction();
OleDbCommand cmd = new OleDbCommand("update Authors set [Year
Born]=1954 where [Year Born]=1954", m_db, tx);
int rc = cmd.ExecuteNonQuery();
tx.Commit();
}

private void button2_Click(object sender, EventArgs e)
{
m_db.Close();
}



After I clicked button1, the .ldb file is created and there; but if I click
button2, the .ldb file will be deleted.


Could you please show some of your code or send me a reproducible project
to test the issue? Thanks.


Regards,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


.


Quantcast