[Mono-list] DataSets + MySQL
Sergio Blanco Cuaresma
sergio-blanco@iespana.es
25 Aug 2003 17:24:24 +0200
--=-ack5whPb5K6lY7AvVFpw
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable
El lun, 25-08-2003 a las 03:17, Reggie Burnett escribi=F3:
> If you are using the ByteFX provider, the following code will update (che=
ck
> for compile errors) from a dataset. This will work on .NET but I have no=
t
> run code like this on Mono but it should work (or be very close anyway).
The code you gave me didn't compile in mono but it helps me a lot, with
some little modifications I get it to work:
string connectionString =3D=20
"Server=3Dlocalhost;" +
"Database=3Dmonotest;" +
"User ID=3Dmono;" +
"Password=3DXXXXX;";
=20
MySQLConnection conn =3D new MySQLConnection(connectionString);
MySQLDataAdapter da =3D new MySQLDataAdapter("select * from personas",=20
conn);
DataSet ds =3D new DataSet();
da.Fill(ds, "personas");
//ds.Tables[0].Rows[0]["firstname"] =3D "Sergio2";
ds.Tables["personas"].Rows[0]["firstname"] =3D "Sergio2";
ds.Tables[0].Rows[2].Delete();
Console.WriteLine("{0}", ds.Tables[0].Rows[0]["firstname"]);
// now perform the update
MySQLCommandBuilder cb =3D new MySQLCommandBuilder(da);
da.Update(ds, "personas");
Thanks Reggie! Now I have a base from where I can learn :-)
--=20
[aka Marble]
Registered LiNUX user #140941 <> http://counter.li.org/
Socio #3274 de HispaLinux <> http://www.hispalinux.es
Miembro de GPL URV <> http://www.gplurv.org
GnuPG key: 0x0ED2CF9D <> pgp.escomposlinux.org
--=-ack5whPb5K6lY7AvVFpw
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
digitalmente
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQA/SionfGXf5g7Sz50RAo95AKC/mwmIf/YA+g73OzXU8FCbyL3H+gCePcXI
icjfJU+XG5A3ZvLv4wLI+Ng=
=LU47
-----END PGP SIGNATURE-----
--=-ack5whPb5K6lY7AvVFpw--