Implicit Transaction - InfoPath Dev
in

InfoPath Dev

Implicit Transaction

Last post 12-05-2008 05:19 AM by Shiva. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-28-2008 01:20 PM

    Implicit Transaction

    I use something like the following code when I need to save data fields on SQL Server:

    XDocument.QueryAdapter.Command = "exec dbo.SaveSQLComplexDBinfo " + SQLComplexDBID + ",'" + ComplexName + "','" + DBName + "','" + AppCode + "'";
    XDocument.Query();

    When I check database activity, I see that something like this will be issued to SQL Server:

    set implicit_transactions on SET NO_BROWSETABLE ON
    exec dbo.SaveSQLComplexDBinfo 96,SQLDA-CX02','ATT25','ACTT'
    IF @@TRANCOUNT > 0 ROLLBACK TRAN

    I need the data to be saved. Why does Query() method wrap the actual query in a transaction and how can I prevent that?

    Thanks

  • 12-05-2008 05:19 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Hello,

    Here is the code to execute StoreProcedure,

    SqlCommand command =  new SqlCommand("dbo.SaveSQLComplexDBinfo", sqlConnection);

    command.CommandType = System.Data.CommandType.StoredProcedure;

    command.Parameters.Add("@SQLComplexDBID", SqlDbType.Int).Value = "96";

    command.Parameters.Add("@SQLComplexDBID", SqlDbType.Int).Value = "SQLDA-CX02";

    command.Parameters.Add("@ComplexName ", SqlDbType.Int).Value = "ATT25";

    command.Parameters.Add("@DBName", SqlDbType.Int).Value = "ACTT";

    int i = command.ExecuteNonQuery();

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.