Exemple #1
0
        static int Main(string[] args)
        {
            if (args.Count() != 1)
            {
                Console.Out.WriteLine("Usage: ConsoleSample.exe <dbname>\n");
                return 1;
            }

            try {
                HelloDB helloDB = new HelloDB(args[0]);

                helloDB.CreateTable();
                helloDB.AddNames();
                string name = helloDB.GetName(12);

                Console.Out.WriteLine("The NAME with id of 12 is '{0}'\n", name);

            }
            catch (Exception xcp)
            {
                Console.Out.WriteLine("Got exception: {0}\n", xcp.Message);
                return 2;
            }

            return 0;
        }
Exemple #2
0
        static int Main(string[] args)
        {
            if (args.Count() != 1)
            {
                Console.Out.WriteLine("Usage: ConsoleSample.exe <dbname>\n");
                return(1);
            }

            try {
                HelloDB helloDB = new HelloDB(args[0]);

                helloDB.CreateTable();
                helloDB.AddNames();
                string name = helloDB.GetName(12);

                Console.Out.WriteLine("The NAME with id of 12 is '{0}'\n", name);
            }
            catch (Exception xcp)
            {
                Console.Out.WriteLine("Got exception: {0}\n", xcp.Message);
                return(2);
            }

            return(0);
        }