#7 IDataReader

closed
nobody
None
5
2003-12-05
2003-09-21
Anonymous
No

Why this code don't want to compile???

using System;
using System.Data;
using MySQLDriverCS;

namespace Mysql_skuska
{
class Class1
{
static void Main(string[] args)
{
MySQLConnection conn = new MySQLConnection(
new MySQLConnectionString
("localhost","mysql","root","milan").AsString );

string select = "select * from c_brozury";
conn.Open();
MySQLCommand command = new MySQLCommand
(select, conn);

MySQLDataReader reader = command.ExecuteReader();
while(reader.Read())
Console.WriteLine("{0} ", reader[0]);
Console.ReadLine();
conn.Close();
}
}
}

When MySQLDataReader implement IDataReader
interface???...

Discussion

  • Manuel Lucas Viñas Livschitz

    Logged In: YES
    user_id=406263

    replace MySQLDataReader reader = command.ExecuteReader
    ();
    by MySQLDataReader reader = (MySQLDataReader )
    command.ExecuteReader();

     
  • Manuel Lucas Viñas Livschitz

    • status: open --> closed
     

Log in to post a comment.