Tema: Re: DataSet Multiple SQL result (ar imanoma?)
Autorius: VyvIT
Data: 2010-02-02 15:49:03
mazdaug taip gal :]

            SqlDataReader reader = null;
            var tables = new DataTable[2];
            try
            {
                command.CommandTimeout = 120;
                lock (command.Connection)
                {
                    if (command.Connection.State != ConnectionState.Open)
                        command.Connection.Open();

                    reader = command.ExecuteReader();
                    for (int i = 0; i < tableCount; i++)
                    {

                        var table = new DataTable
                                        {
                                            Locale = 
System.Globalization.CultureInfo.InvariantCulture
                                        };
                        table.BeginLoadData();
                        table.Load(reader);
                        table.EndLoadData();
                        table.TableName = string.Format("Results{0}", i);
                        tables[i] = table;
                    }
                    reader.Close();
                }
            }
            catch (SqlException)
            {
                if (reader != null)
                    reader.Close();
                throw;
            }
            return tables;



"Jornada Del Muerto" <ask@me.email> wrote in message 
news:hk9a31$rns$1@trimpas.omnitel.net...
> Sveiki,
>
>    Tokia briedova ideja kilo, pvz turiu MSSQL ir as galiu proceduroje 
> daryti:
>
>    CREATE PROCEDURE MyProc AS
>
>    Select * From lenta1 where type=1
>    Select * From lenta1 where type=10
>    Select * From lenta2
>    Select * From lenta3
>
>    Tada jei kokiam nors manageryje paleisit tokia proc tai kaip visi zino 
> grazins kelis rezultatus, o ar eitu taip kad ir i DataSet'a paimt per 
> ADO.NET
>
>
>    Tipo daugmaz standartinis kreipimasis i SQL ir DataSet.Load, yra siaip 
> toks metodas bet jis tada klausai lentu vardu, bet as gal 10 selectu 
> skirtingu is tos pacios darau...
>
>    Dar yra DataAdapter.Fill bet as negaliu gauti is IDbConnection jo 
> IDataAdapter, nes dirbu interface'u lygyje...
>
>    Gal kas bande? pavyko nepavyko? ar siaip turi nuomuone ?
>