Insert SQL taking long time RRS feed

  • Question

  • User1322260587 posted

    I'm experince slowness on using the data application block to insert a record into DB. So, to prove it, I created the non-application block code to insert a record and it come back right away, I'm talking about second vs minutes here, does anyone experince this problem? hope this is soemthing simple that I'm missing here. By the way, the db is using SQL server.

    using Application Block ex:

    string sql = "INSERT INTO emp (firstName, lastName, InsertDate) VALUES ('John', 'Smith',  GETDATE())";

    DBCommandWrapper insertCommandWrapper = db.GetSqlStringCommandWrapper(sql);

    IDbConnection connection = db.GetConnection();


    IDbTransaction transaction = connection.BeginTransaction();




    using non-Application Block ex:

    SqlConnection myConnection;

    myConnection = new SqlConnection("server=myserver; database=newDB;");

    string insertCmd = "INSERT INTO emp (firstName, lastName, InsertDate) VALUES ('John', 'Smith',  GETDATE())";

    SqlCommand myCommand =
    new SqlCommand(insertCmd, myConnection);





    Friday, August 26, 2005 1:30 PM

All replies

  • User-1946651146 posted

    Hi Ricky,

    I haven't experienced the performance problems the you are seeing.  However, I'm not suprised that your second block of code was much faster. There is no need for the transaction in the DAAB code.  Try it without the transaction and see if you still have the problem.


    Monday, September 26, 2005 10:30 PM