System.Data.Common.DataAdapter.Fill(System.Data.DataSet)

Here are the examples of the csharp api class System.Data.Common.DataAdapter.Fill(System.Data.DataSet) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: nuodb-dotnet
Source File: TestFixture.cs
View license
[Test]
        public void TestDisconnected()
        {
            using (NuoDbConnection connection = new NuoDbConnection(connectionString))
            {
                DataAdapter da = new NuoDbDataAdapter("select * from hockey", connection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    for (int i = 0; i < r.ItemArray.Length; i++)
                    {
                        if (i > 0)
                            Console.Out.Write(", ");
                        Console.Out.Write(r.ItemArray[i]);
                    } // for
                    Console.Out.WriteLine();
                } // foreach 

                DataTable hockey = ds.Tables[0];
                var query = from player in hockey.AsEnumerable()
                            where player.Field<string>("Position") == "Fan"
                            select new
                            {
                                Name = player.Field<string>("Name")
                            };
                int count = 0;
                foreach (var item in query)
                {
                    Console.Out.Write(item.Name);
                    count++;
                }
                Assert.AreEqual(1, count);

            }
        }