[Mono-list] [PATCH] error in ADO.NET mysql example
Josef El-Rayes
j.el-rayes@daemon.li
Sat, 1 Mar 2003 23:15:05 +0100
--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
hi!
there has to be a cast from object to string in order
to put the value from reader["firstname"] into string
FirstName. Same for sirname.
greets, josef
--
www: http://www.daemon.li
nic-hdl: JER1080312-NICAT
FreeBSD PortMaintainer
Student of ComputerScience
--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mysql.diff"
--- mysql.orig 2003-03-01 23:02:09.000000000 +0100
+++ mysql 2003-03-01 23:02:36.000000000 +0100
@@ -190,8 +190,8 @@
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
- string FirstName = reader["firstname"];
- string LastName = reader["lastname"];
+ string FirstName = (string) reader["firstname"];
+ string LastName = (string) reader["lastname"];
Console.WriteLine("Name: " +
FirstName + " " + LastName);
}
--8t9RHnE3ZwKMSgU+--