Results 1 to 3 of 3

Thread: DB transaction error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    68

    DB transaction error

    I try to use a transaction to group several DB update together

    But I have the following error message see attachment

    Does anyone know what's wrong ???


    Global_Data.CnPolitis.Open() 'Connector open

    ' 1- New transaction
    Dim OleDbTrans As OleDbTransaction
    Dim CmdOleDb As New OleDbCommand()
    OleDbTrans = Global_Data.CnPolitis.BeginTransaction
    CmdOleDb.Connection = Global_Data.CnPolitis
    CmdOleDb.Transaction = OleDbTrans
    Try
    ...
    CmdOleDb = New OleDbCommand("AjoutDossier", Global_Data.CnPolitis)

    CmdOleDb.CommandType = CommandType.StoredProcedure

    CmdOleDb.Parameters.Clear()

    Param = New OleDbParameter()
    Param.ParameterName = "@TYPEDOSSIER"
    Param.Direction = ParameterDirection.Input
    Param.OleDbType = OleDbType.VarChar
    Param.Value = ComboBoxTypeDossier.SelectedValue
    CmdOleDb.Parameters.Add(Param)

    ------->>>>> CmdOleDb.ExecuteNonQuery() 'ERROR


    End try


    If I put OleDbTrans in comment It work fine but if one update fail, the other are in the DB (Order detail without Order header)

    Thanks for your help
    Attached Images Attached Images  
    Last edited by oxbow123; Jun 12th, 2003 at 07:54 AM.

  2. #2
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    Try using:

    VB Code:
    1. Dim OleDbTrans As OleDb.OleDbTransaction = cnnObject.BeginTransaction()

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    68
    The error occurs when I execute the line "CmdOleDb.ExecuteNonQuery"

    Any idea ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width