T
temp
Greetings!
I've written a console application to perform some trivial database
routines. When I run the application, it catches the an OleDbException
that states "The search key was not found in any record." My C# code
follows:
=============== snip ==========================
OleDbCommand cmd = new OleDbCommand(sqlstmt, new
OleDbConnection(cnct));
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.Read(); // used to pause application long enough to read
message
}
cmd.Dispose();
=============== snip ==========================
sqlstmt = "DELETE FROM Accounts WHERE AccountID > 3"
cnct = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA
SOURCE=data_source;Persist Security Info=False;Jet OLEDBatabase
Password=password"
where data_source is the fully qualified local path of the database and
password is, well, obvious (I hope).
I've checked the database and it contains the Accounts table and
AccountID column. The AccountID column does have numbers greater than
three.
I have run this application before in the past with success. It is an
enigma to me why it is no longer functioning. I did recently install
the .NET Framework 2.0 update, but even after uninstalling it, I still
received the exception.
Any assistance that could be provided would be greatly appreciated.
Thanks.
Tim
I've written a console application to perform some trivial database
routines. When I run the application, it catches the an OleDbException
that states "The search key was not found in any record." My C# code
follows:
=============== snip ==========================
OleDbCommand cmd = new OleDbCommand(sqlstmt, new
OleDbConnection(cnct));
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.Read(); // used to pause application long enough to read
message
}
cmd.Dispose();
=============== snip ==========================
sqlstmt = "DELETE FROM Accounts WHERE AccountID > 3"
cnct = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA
SOURCE=data_source;Persist Security Info=False;Jet OLEDBatabase
Password=password"
where data_source is the fully qualified local path of the database and
password is, well, obvious (I hope).
I've checked the database and it contains the Accounts table and
AccountID column. The AccountID column does have numbers greater than
three.
I have run this application before in the past with success. It is an
enigma to me why it is no longer functioning. I did recently install
the .NET Framework 2.0 update, but even after uninstalling it, I still
received the exception.
Any assistance that could be provided would be greatly appreciated.
Thanks.
Tim