示例#1
0
 private void AddTableToSchema(SqlTable table)
 {
     if (table != null)
     {
         listTables.Add(table);
     }
 }
示例#2
0
        // unificate with getViews
        private void GetTables()
        {
            var sb = new StringBuilder();
            sb.Append("USE [@dbname] SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ");
            sb.Append("WHERE TABLE_SCHEMA = '@tablename' AND TABLE_TYPE = 'BASE TABLE' ");
            sb.Append("ORDER BY TABLE_NAME");

            sb.Replace("@dbname", parent.Name);
            sb.Replace("@tablename", name);

            var conn = parent.Parent.GetConnection();
            var cmd = new SqlCommand(sb.ToString(), conn);

            try
            {
                conn.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    string s = rdr[0].ToString();
                    var oSqlTable = new SqlTable(this, s);
                    AddTableToSchema(oSqlTable);
                }
            }

            catch (Exception ex)
            {
                Utils.WriteLog(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
示例#3
0
 public Column(SqlTable parent, string name)
 {
     this._parent = parent;
     this.name = name;
 }
示例#4
0
 public Column(SqlTable parent, string name)
 {
     this._parent = parent;
     this.name    = name;
 }