What is C# equivalent of PHP's mysql_fetch_array function?

Posted by Mike Biff on Stack Overflow See other posts from Stack Overflow or by Mike Biff
Published on 2012-06-30T19:34:14Z Indexed on 2012/06/30 21:16 UTC
Read the original article Hit count: 378

Filed under:
|
|

I am learning C#/ASP.NET and I am wondering what the C# equivalent of the following PHP code is? I know the userid, and I want to fetch the rows from this table into the array of the variable "row", so I then can use it as "row['name']" and "row['email'].

$result = mysql_query("SELECT email, name FROM mytable WHERE id=7");

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    printf("Email: %s  Name: %s", $row["email"], $row["name"]);
}

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql