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 8105785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:15:31+00:00 2026-06-06T00:15:31+00:00

I have two scripts that are called in one program, the first script creates

  • 0

I have two scripts that are called in one program, the first script creates a database, and the other is a script to fill the database.

How to know if the first script is finished before launching the second one?

How to wait for second script that the first notice that the process is over? How can server inform the creation of the database program and then proceed with further work?
Code

string createDatabasePath = args[0];

        sqlConnectionStr = Properties.Settings.Default.conString;
        SqlConnection conn = new SqlConnection(sqlConnectionStr);
        conn.Open();
        SqlCommand comm = new SqlCommand();
        comm.Connection = conn;
        FileInfo file = new FileInfo(createDatabasePath);
        string script = file.OpenText().ReadToEnd();
        script = script.Replace("GO", "");
        comm.CommandText = script;
        comm.ExecuteNonQuery();

My problem is when executenonquery finiched?how I know ?

  • 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-06T00:15:33+00:00Added an answer on June 6, 2026 at 12:15 am

    We need to know what “in one program” means – is that a set of T-SQL commands or a C# application, etc.? However, the easiest way to make sure one is done before the other is just to combine them into a single procedure, or have the first one call the second one:

    ...Do the stuff in Process1;
    EXEC Process2;
    

    A more complicated option is to alter the second process to check that the new database exists and WAITFOR some time until it’s complete:

    DECLARE @I INT
    SET @I = 0
    
    WHILE @I = 0
    BEGIN
        IF OBJECT_ID('NewDB..tblFinalTableCreated') IS NOT NULL 
            SET @I = 1
        ELSE 
            WAITFOR DELAY '00:05:00' --Wait 5 minutes
    END
    
    StartProcess2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two scripts running on the same page, one is the jQuery.hSlides.js script
I have written two scripts where one script calls subprocess.Popen to run a terminal
I have two domains. One domain contains the login script. It creates a cookie
I have a script that runs every two minutes for a Tweet-getter application. In
I have a script that generates two lines as output each time. I'm really
I have an MSBuild script that uses NUnit to run tests in two assemblies.
I currently have a ajax script that dynamically builds two select boxes enabled with
My script is here : jsfiddle i have two attributes in my form that
i have two files one called stats.js one called storage.html in stats.js in contains
I have a simple script that should cause one of three divs to be

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.