コード例 #1
0
        //
        // Define()
        //
        // Create the table for containing a list of existing customers
        //

        static void Define()
        {
            Console.WriteLine("DEFINE");

            try
            {
                // create table
                Console.WriteLine("\tCreate table...");
                cmd.CommandText = "CREATE TABLE custmast (" +
                                  "cm_custnumb CHAR(4)," +
                                  "cm_custzipc CHAR(9)," +
                                  "cm_custstat CHAR(2)," +
                                  "cm_custrtng CHAR(1)," +
                                  "cm_custname VARCHAR(47)," +
                                  "cm_custaddr VARCHAR(47)," +
                                  "cm_custcity VARCHAR(47))";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
        }
コード例 #2
0
        //
        // Delete_Tables()
        //
        // This function removes all existing tables
        //

        static void Delete_Tables()
        {
            try
            {
                cmd.CommandText = "DROP TABLE ordritem";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
            try
            {
                cmd.CommandText = "DROP TABLE custordr";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
            try
            {
                cmd.CommandText = "DROP TABLE custmast";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
            try
            {
                cmd.CommandText = "DROP TABLE itemmast";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
        }
コード例 #3
0
        //
        // Create_CustomerMaster_Table()
        //
        // Create the table CustomerMaster
        //

        static void Create_CustomerMaster_Table()
        {
            Console.WriteLine("\ttable CustomerMaster...");

            try
            {
                cmd.CommandText = "CREATE TABLE custmast (" +
                                  "cm_custnumb CHAR(4)," +
                                  "cm_custzipc CHAR(9)," +
                                  "cm_custstat CHAR(2)," +
                                  "cm_custrtng CHAR(1)," +
                                  "cm_custname VARCHAR(47)," +
                                  "cm_custaddr VARCHAR(47)," +
                                  "cm_custcity VARCHAR(47))";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }

            try
            {
                cmd.CommandText = "CREATE UNIQUE INDEX cm_custnumb_idx ON custmast (cm_custnumb)";
                cmd.ExecuteNonQuery();
            }
            catch (CtreeSqlException e)
            {
                Handle_Exception(e);
            }
            catch (Exception e)
            {
                Handle_Exception(e);
            }
        }