Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, April 19, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 External Development Forums - SalesLogix OLEDB Provider
Forum to discuss using the SalesLogix OLE DB Provider from external applications (including usage of built-in provider procedures). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix OLEDB Provider | New ThreadView:  Search:  
 Author  Thread: Is the OleDB Provider able to handle Transaction processing?
Kate
Posts: 5
 
Is the OleDB Provider able to handle Transaction processing?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 11 1:56 PM
fiogf49gjkf0d

The process I am trying to create inserts new account records into the Address and Account tables. But, I don't want to create a new Account without an Address, so I need to use a Transaction.


If I pass the SQL Insert statements to the OleDB provider individually, they execute, successfully.  But, if I pass them to the provider in a oledb transaction, the statement fails to parse the SQL on the first command and the transaction is rolled back. Yell


Is the SLX OleDB provider able to handle transaction processing. And, if so, is it configured differently than a Microsoft's OleDB transaction?



Public Sub ExecuteTransaction(ByVal connectionString As String)

    Using connection As New OleDbConnection(connectionString)
        Dim command As New OleDbCommand()
        Dim transaction As OleDbTransaction

        ' Set the Connection to the new OleDbConnection.
        command.Connection = connection

        ' Open the connection and execute the transaction.
        Try
            connection.Open()

            ' Start a local transaction with ReadCommitted isolation level.
            transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)

            ' Assign transaction object for a pending local transaction.
            command.Connection = connection
            command.Transaction = transaction

            ' Execute the commands.
            command.CommandText = _
                "Insert into Address(AddressID, Address1, City, State, PostalCode) VALUES ('a6UJ9A001WEC','1 Main Street','Reading','PA','19610'  "
            command.ExecuteNonQuery()
            command.CommandText = _
                "Insert into Account(AccountID, AddressID, Account) VALUES ('A6UJ9A000VWK', 'a6UJ9A001WEC', 'Account Name')"
            command.ExecuteNonQuery()

            ' Commit the transaction.
            transaction.Commit()
            Console.WriteLine("Both records are written to database.")

        Catch ex As Exception
            Console.WriteLine(ex.Message)
            ' Try to rollback the transaction
            Try
                    transaction.Rollback()

            Catch
                ' Do nothing here; transaction is not active.
            End Try
        End Try
        ' The connection is automatically closed when the
        ' code exits the Using block.
    End Using
End Sub

Please advise? 

Thanks!!!! 

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Is the OleDB Provider able to handle Transaction processing?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 11 3:01 PM
fiogf49gjkf0d

yes it can.....you've got a mix here however.....command object and transaction processing.....


 


We open up an ADO Recordset....BegnTrans, Update, End Trans kinds of stuff.....works fine.

[Reply][Quote]
Kate
Posts: 5
 
Re: Is the OleDB Provider able to handle Transaction processing?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 11 3:33 PM
fiogf49gjkf0d

Never mind, must have been something in my script. I've got it working now.Embarassed


Thanks anyway!

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Is the OleDB Provider able to handle Transaction processing?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Feb 11 4:50 PM
fiogf49gjkf0d

Awesome! Now off for some Italian food and a 25th Wedding Anniversary celebration.....ours!  Smile

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 4/19/2024 9:52:16 AM