Example #1
0
        static void MetaCollections()
        {
            using (SqlDatabaseConnection cnn = new SqlDatabaseConnection("uri=@memory"))
            {
                cnn.Open();

                //Available Meta Data Collections in this connection.
                // Let's use foreach loop to get all the meta collections
                foreach (DataRow r in cnn.GetSchema("METADATACOLLECTIONS").Rows)
                {
                    if (r["NumberOfRestrictions"].Equals(0))
                    {
                        Console.WriteLine();
                        Console.WriteLine("Starting... {0}", r["CollectionName"].ToString());
                        Console.WriteLine();
                        //Load another datatable CollectionDT with values
                        DataTable CollectionDT = cnn.GetSchema(r["CollectionName"].ToString());
                        foreach (DataColumn column in CollectionDT.Columns)
                        {
                            Console.Write(column.ColumnName + "\t");
                        }
                        Console.WriteLine(Environment.NewLine);
                        foreach (DataRow row in CollectionDT.Rows)
                        {
                            foreach (DataColumn column in CollectionDT.Columns)
                            {
                                Console.Write(row[column.ColumnName] + "\t");
                            }
                            Console.WriteLine();
                        }
                    }
                }
            }
        }