No associative arrays for MySQL?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Fuitad
Posts: 6
Joined: Mon 12 Feb 2007 15:13

No associative arrays for MySQL?

Post by Fuitad » Mon 12 Feb 2007 15:22

Hello,

I'm playing with the Trial and I'm comparing it with the MySQL .net connector (version 5).

Right now I use the following functions

Code: Select all

LoggedInID = sqldr.GetInt32("userid");
LoggedInAs = sqldr.GetString("realname");
(sqldr being a MySqlDataReader)

I tried to run the same commands in mysqldirect and was suprised to see that it didin't work. By looking in the help file, I saw this:

Code: Select all

public override int GetInt32(int i);
public override string GetString(int i);
Now, I'm asking, did I get all of this wrong? Is there no way to refence to a data column by it's name? Because frankly, I've always thought that reading data by column index was a bad move as it's not as reliable as column name.

Thank you for your answer.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Wed 14 Feb 2007 12:49

SqlDataReader doesn't have such overloads as well.
You can use something like this:

Code: Select all

LoggedInAs = sqldr["realname"];

Fuitad
Posts: 6
Joined: Mon 12 Feb 2007 15:13

Post by Fuitad » Thu 15 Feb 2007 20:17

Even better! :)

Thanks

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 16 Feb 2007 08:24

You are welcome.

Post Reply