Multiple resultsets from one query


This is done just by separating the different queries with a semicolon:



        public DataTable GetData2()
        {


            Npgsql.NpgsqlConnection oConn = new Npgsql.NpgsqlConnection("Server=192.168.10.4;Port=5432;Userid=postgres;Password=stefan;Protocol=3;SSL=false;Pooling=true;MinPoolSize=1;MaxPoolSize=20;Encoding=UNICODE;Timeout=15;SslMode=Disable;Database=pagila");
            oConn.Open();

            DataSet oDataSet = new System.Data.DataSet();

            Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand("select * from city; select * from country", oConn);
            // Now add the parameter to the parameter collection of the command specifying its type.
//            command.Parameters.Add(new Npgsql.NpgsqlParameter("col1", DbType.Int32));

            // Now, add a value to it and later execute the command as usual.
            //            command.Parameters[0].Value = 8;

            Npgsql.NpgsqlDataAdapter oAdapter = new Npgsql.NpgsqlDataAdapter(command);
            oAdapter.Fill(oDataSet);
            DataTable dt = oDataSet.Tables[0];
            DataTable dt2 = oDataSet.Tables[1];
            oConn.Close();

            return dt2;


        }