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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:43:28+00:00 2026-05-15T07:43:28+00:00

Group, Part 1: I’m currently working on a command line utility that can take

  • 0

Group,

Part 1:
I’m currently working on a command line utility that can take args and update a local database. The only issue I have is once i established a “Data connection”..how can I use those args for queries and searches.

For example:
~//arrInput.exe “parm1” “pram2” “pram3”

Part 2:
I would like to take in command line args and use them as input parms for a “stored proc”. Once finished execution….used the same inputs crate a log file.

For example output file:

mm-dd-yyyy hh:mm:ss – pram1,pram2,…

pram1: updated/failed

pram2: update/failed

Thanks,

Chad

  • 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-05-15T07:43:29+00:00Added an answer on May 15, 2026 at 7:43 am

    Here is the SQL end of things, as far as making an output file, thats pretty basic so Ill leave that code up to you. There are other options for executing the query, depends on what you need in your implementation.

    edit Can you be a little more specific in what you are looking for? Ill add the code for making a log as well I suppose and write out everything.

    edit 2 For an accdb file you will need to use an OleDB connection not a SQL connection as shown in this diagram. I have edited the code below to work with an accdb file. I am not as familiar with this so I can’t promise it will work 100% but the only issues should be syntax. By the way none of the inputs are sanitized and it may be better to parametrize the inputs, but since it sounds like you are running this yourself it shouldnt be necessary. If this answers your questions please mark as accepted 🙂

    using System.Data.OleDB;
    using System.IO;
    
    static int Main(string[] args)
    {
        //Make a list to hold your params
        List<string> paramList = new List<string>();
    
        //Populate the list based on args
        for (int i = 0; i < args.Length(); i++) 
        {
            paramList.Add(args[i]);
        }
    
        //Create a new oledb connection
        string path = "c:\\yourfilepath\\file.accdb";
        OleDbConnection myConnection = 
            new SqlConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" +
            path + "';");
        myConnection.Open();
    
        //Run the stored proc on each param and output result to file
        using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"filepath\filename"))
        {
            foreach (string param in paramList)
            {
                //myCommand.CommandText is the query you want to run against your database
                //i.e. the stored proc
                OleDbCommand myCommand = myConnection.CreateCommand();
                myCommand.CommandText = "stored_proc " + param;
                OleDbDataReader myReader = myCommand.ExecuteReader();
                if (myReader.HasRows)
                {
                    file.WriteLine("pass: " + param);
                } 
                else 
                {
                    file.WriteLine("fail: " + param);
                }
                myReader.Close();
            }
        }
    
        myConnection.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given : Group hasMany Persons but the relationship is independent (ie. Persons can exist
My group is a Perl shop in an organization that is very heterogenous. Although
My group has a source analysis tool that enforces certain styles that we have
I've got a group of inter-related classes that are all overridden together to create
I have a group of checkboxes that I only want to allow a set
Suppose that a group wants to encrypt some information, then share the encryption key
My group is developing a service-based (.NET WCF) application and we're trying to decide
My group is moving to Team Foundation Server soon. Actually, I'm heading up the
My group is thinking about switching our platform for web UI from ASP.net to
Anyone know what group I need to belong to show up in the sp_help_operator

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.