[Mono-list] Proper data abstraction of Npgsql.NpgsqlCommandBuilder

Francisco Figueiredo Jr. fxjrlists at yahoo.com.br
Sun Sep 3 20:22:36 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrus wrote:
> How to change the following code so that it works with data providers other 
> than npgsql ? Npgsql.NpgsqlCommandBuilder does not implement any common 
> interface.
> System.Data.ICommandBuilder builder; causes error.
> 

NpgsqlCommandBuilder doesn't implement any interface.

You may need to create some adaptor which can use a custom common
interface. This way you would have adapters for each provider you want
to use.


> 
> private System.Data.IDbDataAdapter DataAdapter1;
> 
> private void button1_Click(object sender, EventArgs e)
> {
> 
> 
> Npgsql.NpgsqlCommandBuilder builder;
> 
> builder = new Npgsql.NpgsqlCommandBuilder(this.DataAdapter1);
> 
> this.DataAdapter1.InsertCommand =
>       builder.GetInsertCommand(this.dataSet1.Tables[1].Rows[1]);
> ....
> }

Hmmm, while working with commandbuilder and dataadapter, you don't need
to specify manually the insert command. NpgsqlCommandBuider can do that
for you automatically.

I hope it helps.



- --
Regards,

Francisco Figueiredo Jr.
http://fxjr.blogspot.com
Npgsql Lead Developer
http://pgfoundry.org/projects/npgsql
Mono Project Contributor
http://www.go-mono.com
MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org


- --
 - Would you tell me, please, which way I ought to go from here?
 - That depends a good deal on where you want to get to.
 		-- Lewis Carroll "Alice's Adventures in Wonderland"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRPtxzP7iFmsNzeXfAQLCrQgAnqvxsoImc26pgG0SXVkSMsXmk/Fb9RNa
xgegQl9LfuOSFQX+3pCv91DOYGY6M7gmKCyL2guvyOEkz+A8QIfYDGybSh0AEF9L
scsOunVlXUI6E9wA7zF/oItqEvZffAAAS1j7wLjcS8izhvX49FnaYVOIsQK2VnI4
6eUXT5M138Qmg0x3rfiPm9R4Mz/I2YNcLzd9cS49M/9y/V9krF5Pmy8SZud53fAG
KiUoQ2JO7mVGCb6EuY5EU3IRTeWpMX8q0y6SXD0WKlVwllPc7dfD91ss444huTC9
1GT2gj+zbv6VVf4y7jC1z2CWg6U8MR6Qr5UbhQrrjrot9ivNBvjn/w==
=ALgJ
-----END PGP SIGNATURE-----

		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 



More information about the Mono-list mailing list