Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:57:37+00:00 2026-06-17T05:57:37+00:00

I am running unit tests and when I try to insert data in the

  • 0

I am running unit tests and when I try to insert data in the database and getting it right after, I don’t get anything (I have tried with DataAdapter and DataReader).

However when I put a 3 seconds sleep (even with 1 second it doesn’t work…) between the insert and the select I get the result.

In SQL Server Profiler I can see the execution, the insert is well done and is completed about 10 miliseconds before the select begins.

I can’t find out where this comes

The code looks like this :
Insert method

SqlCommand command = new SqlCommand(sqlTemplate);
command.Parameters.Add(Sql4oConstants.Sql4oIdParameterName, SqlDbType.UniqueIdentifier).Value = id;
command.Parameters.Add(Sql4oConstants.Sql4oTimestampParamterName, SqlDbType.DateTime).Value = DateTime.Now;

command.CommandTimeout = dataSourceDescription.CommandTimeout;
DatabaseManager.ExecuteNonQuery(dataSourceDescription.ConnectionString, command);

Get method

public static void Fill(string connectionString, DataTable table, SqlCommand command)
    {
        try
        {
            LogStorageWriter.WriteLogEntry(log, EStorageLevelLog.Debug, string.Format("Execute query: {0}", command.CommandText));

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                command.Connection = conn;
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.Fill(table);
                }
            }
        }
        catch (InvalidOperationException e)
        {
            LogStorageWriter.WriteLogEntry(log, EStorageLevelLog.Error, string.Format("Exception : {0}", e.ToString()));
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:57:38+00:00Added an answer on June 17, 2026 at 5:57 am

    I solved it.

    In fact, it was because my request used a CONTAINS. I then discovered that using a CONTAINS calls the SQL Server Indexer to fetch data. But the engine does not index data instantly.
    That’s why I had to wait 2 or 3 seconds to get my data back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling getting some unit tests running and wondering if anyone might have anything
We have some unit tests running against a SQL server 2000 database using the
I am trying to get a ASP.NET Unit Test running and I keep getting
I have some MSTest unit tests that are running just fine on my machine
I have some unit tests that use Azure Storage. When running these locally, I
Quick JUnit question. I'm running some unit tests that involve starting up the GUI
Is there an API for running Visual Studio Unit Tests programmatically? Running MSTests.exe with
We want to run our unit tests on our TFS server. We are running
I am looking to implement a continuous unit test running system, something I have
I am running PHP unit as follows: phpunit --debug --verbose --coverage-clover=/tmp/test.xml and get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.