locked
Pick up and pass arguments (Winforms) RRS feed

  • Question

  • Hi,

     

    I have made a program that stores queries in a SQLite database. When you start the program, you must first make a connection with an Oracle database. The connection is also stored in the SQLite database. If the connection is successful, the queries assigned to the oracle connection are retrieved from the SQLite database and placed in a treeview. If you then double click on a treeview node, the query will be executed and you will see the possible result in a datagridview. You can also check multiple treeview nodes and then all checked queries will be executed consecutively.

     

    Now I want to extend my program with the following (Or start from scratch to allow for the following). I want to be able to start the program with arguments and then run the chosen queries so that I can put it in the task manager and run certain queries automatically without having to manually start the program. I know I could make a sql script but I would like to do that with this program. I also know how to read arguments when a program starts. But how can I best pick up the Oracle connection and control / execute the queries? It is a WinForm application.

     

    Please give tips on how to do this.

     

    Greatings
    Saturday, August 22, 2020 8:30 AM

All replies

  • Hi Hans

    From my understanding you need two connection object .one is  for SQLite and another for oracle.

    So you need two connection string .One is for SQLite and another for Oracle .

    1= Download SQLite from nugate package and install .

    https://www.codeguru.com/csharp/.net/net_data/using-sqlite-in-a-c-application.html

    2-download oracle driver from nugate and install

    https://www.nuget.org/packages/Oracle.ManagedDataAccess/

    First connect to SQLite and retrive the data for connect to oracle

    Then connect to oracle data base

    Thanks and regards

    Sunday, August 23, 2020 2:44 PM
  • Hi HansvB69,

    Thank you for posting here.

    If you want the entire program to run automatically, then some of the steps described in the first paragraph are not needed.

    For example, let the user choose which database instance to connect to, and let the user select which nodes of the treeview, these information should be written directly in the parameters.

    Your form will only have datagridview left to display data.

    Is this what you want? Did I misunderstand what you mean?

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 24, 2020 9:19 AM
  • Hi,

    i wanted the programm to do both. A user must be able to log and connect to Oracle. Works allready that way. And it must be able to run automatic.

    i think i split it. The app i now have works fine and i need to write a second one that can run automated. Should that second one be a winforms app or is a console app better?

    Thursday, August 27, 2020 6:00 PM
  • If the second app doesn't need any user interaction, then I would recommend a Console app run as a Windows Service (that way it can start automatically). Here's a link to my blog post about a pretty easy way to create a Windows Service based on a Console app:

    https://geek-goddess-bonnie.blogspot.com/2013/10/easy-windows-services.html


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Friday, August 28, 2020 5:03 AM