Ejemplo n.º 1
0
        private static void CreateTable(out string tableid, out string serverid)
        {
            string tablename = "";

            System.Console.WriteLine("Enter TableName");
            tablename = System.Console.ReadLine();
            System.Console.WriteLine("Enter Field name seperated by ,");
            string fields = "";

            tableid = "";
            fields  = System.Console.ReadLine();
            var fs = fields.Split(',');

            serverid = CreateServer();
            if (serverid != "")
            {
                Tz.Net.DataManager dm = new Tz.Net.DataManager(serverid, "");
                dm.NewTable(tablename, "sys");
                foreach (string s in fs)
                {
                    if (s == "UserID")
                    {
                        dm.AddPrimarykey(s, System.Data.DbType.String, 25);
                        //  dm.AddField(s, System.Data.DbType.String, 25, true);
                    }
                    else
                    {
                        dm.AddField(s, System.Data.DbType.String, 25, true);
                    }
                }
                try
                {
                    dm.AcceptChanges();
                    tableid = dm.getTableID();
                    System.Console.WriteLine("table created");
                    System.Console.ReadLine();
                }
                catch (System.Exception ex) {
                    tableid = "";
                    System.Console.WriteLine(ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        private static void addColumn(string tbID, string serverid)
        {
            Tz.Net.DataManager dm = new Tz.Net.DataManager(tbID, serverid);
            string             fields;

            fields = System.Console.ReadLine();
            var fs = fields.Split(',');

            foreach (string s in fs)
            {
                if (s == "UserID")
                {
                    dm.AddPrimarykey(s, System.Data.DbType.String, 25);
                }
                else
                {
                    dm.AddField(s, System.Data.DbType.String, 25, true);
                }
            }
            dm.AcceptChanges();
            System.Console.WriteLine("fields added");
            System.Console.ReadLine();
        }