[Mono-list] DbDataAdapter in ADO.NET Provider Factory
Rodrigo Moya
rodrigo@ximian.com
12 Nov 2002 13:22:34 +0100
On Tue, 2002-11-12 at 11:06, Daniel Morgan wrote:
>
> -----Original Message-----
> From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
> Behalf Of Brian Ritchie
> Sent: Tuesday, November 12, 2002 12:04 AM
> To: danmorg@sc.rr.com; tim@timcoleman.com; rodrigo@ximian.com
> Cc: mono-list@ximian.com
> Subject: Re: [Mono-list] DbDataAdapter in ADO.NET Provider Factory
>
>
> Daniel,
>
> Thanks for reminding me about the DataAdapter...we wouldn't want Tim's hard
> work to go to waste. :-)
>
> I've jacked in data adapter support. I'm using the app.config to supply the
> type names (instead of hard coding it in the factory).
>
> Here's the syntax:
>
> // Create Connection
> IDbConnection conn =
> ProviderFactory.CreateConnectionFromConfig("TdsPubsConnStr");
>
> // Select command
> IDbCommand cmd=conn.CreateCommand();
> cmd.Text="select * from author";
>
> // Data Adapter
> DataSet ds=new DataSet();
> IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(cmd);
> adapter.Fill(ds, "Table1");
>
> -- or for the lazy among us :) --
>
> // Create Connection
> IDbConnection conn =
> ProviderFactory.CreateConnectionFromConfig("TdsPubsConnStr");
>
> // Data Adapter
> DataSet ds=new DataSet();
> IDbDataAdapter adapter=ProviderFactory.CreateAdapter(conn, "select * from
> author");
> adapter.Fill(ds, "Table1");
>
> --- or for the super lazy among us (like me) ---
>
> // Create Connection
> IDbConnection conn =
> ProviderFactory.CreateConnectionFromConfig("TdsPubsConnStr");
>
> // Data Adapter
> DataSet ds=DataTools.FillDataSet(conn, "select * from author");
>
>
> Let me know if this will work for you. I'm should have the code committed
> this evening. (I hope).
>
looks really nice!
cheers
--
Rodrigo Moya <rodrigo@ximian.com>