Click here to Skip to main content
15,915,336 members
Home / Discussions / Database
   

Database

 
GeneralRe: What is The Effective Way.... Pin
Mohamad Al Husseiny9-Jan-04 19:21
Mohamad Al Husseiny9-Jan-04 19:21 
GeneralRe: What is The Effective Way.... Pin
Guillermo Rivero10-Jan-04 7:33
Guillermo Rivero10-Jan-04 7:33 
GeneralRe: What is The Effective Way.... Pin
Mohamad Al Husseiny10-Jan-04 19:48
Mohamad Al Husseiny10-Jan-04 19:48 
GeneralRe: What is The Effective Way.... Pin
Guillermo Rivero11-Jan-04 6:07
Guillermo Rivero11-Jan-04 6:07 
GeneralRe: What is The Effective Way.... Pin
Mohamad Al Husseiny11-Jan-04 19:54
Mohamad Al Husseiny11-Jan-04 19:54 
GeneralRe: What is The Effective Way.... Pin
jscorales11-Mar-04 23:35
jscorales11-Mar-04 23:35 
GeneralMultiserver jobs Pin
devvvy6-Jan-04 23:33
devvvy6-Jan-04 23:33 
GeneralError in BeginTransaction method Pin
nthy6-Jan-04 19:52
nthy6-Jan-04 19:52 
HELLO! I've been developing a C# .NET application with mySQL database using ODBC driver (myodbc 3.51) to connect to the database. I've been trying to implement database transaction but encountered an error which I've no idea on how to go about in solving it.

Here's the exception that I got:
**********************************************************
Microsoft.Data.Odbc.OdbcException: ERROR [HYC00] [MySQL][ODBC 3.51 Driver]Transactions are not enabled
at Microsoft.Data.Odbc.OdbcConnection.HandleError(IntPtr hHandle, SQL_HANDLE hType, RETCODE retcode)
at Microsoft.Data.Odbc.OdbcTransaction.set_AutoCommit(Boolean value)
at Microsoft.Data.Odbc.OdbcTransaction.BeginTransaction()
at Microsoft.Data.Odbc.OdbcConnection.BeginTransactionObject(IsolationLevel isolevel)
at Microsoft.Data.Odbc.OdbcConnection.BeginTransaction(IsolationLevel isolevel)
at Solution1.Model.DBAccess.pubic() in c:\documents and settings\nat\desktop\equibs 2004\source\solution1\model\dbaccess.cs:line 478
The thread '<no name="">' (0x1f00) has exited with code 0 (0x0).
The program '[7908] Solution1.exe' has exited with code 0 (0x0).

**********************************************************

Here's what I did:
**********************************************************

OdbcConnection myConnect = new OdbcConnection(myConnString);
myConnect.Open();

OdbcCommand myCommand = myConnect.CreateCommand();
OdbcTransaction myTrans;

try
{
myTrans = myConnect.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
myCommand.Transaction = myTrans;

try
{
myCommand.CommandText = "INSERT INTO `alvin` ( `id` , `value` ) " + "VALUES ('0', '12');";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "INSERT INTO `alvin` ( `id` , `value` ) " + "VALUES ('0', '24');";
myCommand.ExecuteNonQuery();
myTrans.Commit();
Console.WriteLine("Both records are written to database.");
myConnect.Close();

}
catch(Exception e)
{
try
{
myTrans.Rollback();
}
catch (OdbcException ex)
{
if (myTrans.Connection != null)
{
Console.WriteLine("An exception of type " + ex.GetType() + " was encountered while attempting to roll back the transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() + "was encountered while inserting the data.");
Console.WriteLine("Neither record was written to database.");
}
finally
{
myConnect.Close();
}
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}

**********************************************************

Please HELP!!! Thanksss

Confused | :confused:


Love my shoes
GeneralRe: Error in BeginTransaction method Pin
andyharman7-Jan-04 11:21
professionalandyharman7-Jan-04 11:21 
GeneralRe: Error in BeginTransaction method Pin
nthy7-Jan-04 14:24
nthy7-Jan-04 14:24 
Generalsp_depends return value Pin
preinsko6-Jan-04 18:47
preinsko6-Jan-04 18:47 
GeneralRe: sp_depends return value Pin
Mike Dimmick8-Jan-04 5:42
Mike Dimmick8-Jan-04 5:42 
GeneralRe: sp_depends return value Pin
preinsko8-Jan-04 18:00
preinsko8-Jan-04 18:00 
General&quot;Microsoft.Jet.OLEDB.4.0&quot; problem Pin
agrafov6-Jan-04 16:25
agrafov6-Jan-04 16:25 
GeneralRe: &quot;Microsoft.Jet.OLEDB.4.0&quot; problem Pin
Roger Wright6-Jan-04 20:38
professionalRoger Wright6-Jan-04 20:38 
GeneralADO Fields Delete questions Pin
Vaclav6-Jan-04 13:19
Vaclav6-Jan-04 13:19 
GeneralCross databases Pin
totig6-Jan-04 6:10
totig6-Jan-04 6:10 
GeneralRe: Cross databases Pin
Ian Darling6-Jan-04 6:33
Ian Darling6-Jan-04 6:33 
GeneralAccessing fixed length data field Pin
Andrew Hoole6-Jan-04 1:35
Andrew Hoole6-Jan-04 1:35 
GeneralMillions of records per day Pin
coge5-Jan-04 21:11
coge5-Jan-04 21:11 
GeneralRe: Millions of records per day Pin
DiWa5-Jan-04 21:49
DiWa5-Jan-04 21:49 
GeneralRe: Millions of records per day Pin
Mike Dimmick6-Jan-04 2:49
Mike Dimmick6-Jan-04 2:49 
GeneralRe: Millions of records per day Pin
coge6-Jan-04 9:53
coge6-Jan-04 9:53 
GeneralRe: Millions of records per day [modified] Pin
Marek Grzenkowicz8-Jan-04 6:06
Marek Grzenkowicz8-Jan-04 6:06 
GeneralExport to XLS Pin
mosquitooth4-Jan-04 21:49
mosquitooth4-Jan-04 21:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.