Пример #1
0
        public List <DataTable> GetTablesInDatabase(List <string> tableNameList)
        {
            SqlServerExecute sqlServerExe = new SqlServerExecute();
            //DataTable userTables = sqlServerExe.FillDataTable(CommandType.Text, "select name from sysobjects where type = 'U'");
            List <DataTable> tableList = new List <DataTable>();

            foreach (String tableName in tableNameList)
            {
                string    sql = string.Format("select * from {0}", tableName);
                DataTable dt  = sqlServerExe.FillDataTable(CommandType.Text, sql);
                dt.TableName = tableName;
                tableList.Add(dt);
            }

            return(tableList);
        }
Пример #2
0
        public List <string> GetTableNamesInDatabase(string dataBaseName)
        {
            SqlServerExecute sqlServerExe = new SqlServerExecute();
            DataTable        userTables   = sqlServerExe.FillDataTable(CommandType.Text, "use " + dataBaseName + "; select name from sysobjects where type = 'U'");
            List <string>    tableList    = new List <string>();

            foreach (DataRow row in userTables.Rows)
            {
                string sql = string.Format("select * from {0}", row["Name"].ToString());

                if (row["name"] != DBNull.Value)
                {
                    tableList.Add(Convert.ToString(row["Name"]));
                }
            }

            return(tableList);
        }
Пример #3
0
        public System.Data.DataTable GetDishTableInfo(string sql)
        {
            SqlServerExecute SqlExe = new SqlServerExecute();

            return(SqlExe.FillDataTable(CommandType.Text, sql));
        }
Пример #4
0
        public DataTable GetDatabases()
        {
            SqlServerExecute sqlServerExe = new SqlServerExecute();

            return(sqlServerExe.FillDataTable(CommandType.Text, "select name from master..sysdatabases"));
        }
Пример #5
0
        private DataTable GetDataTable()
        {
            SqlServerExecute exe = new SqlServerExecute();

            return(exe.FillDataTable(CommandType.Text, "select Id, Name, Code,Memo from dishmenu"));
        }