No associative arrays for MySQL?

No associative arrays for MySQL?

Postby 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.
Fuitad
 
Posts: 6
Joined: Mon 12 Feb 2007 15:13

Postby 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"];
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Fuitad » Thu 15 Feb 2007 20:17

Even better! :)

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

Postby Alexey » Fri 16 Feb 2007 08:24

You are welcome.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL