using execute reader

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sambarker123
    New Member
    • Feb 2008
    • 3

    #1

    using execute reader

    Hi all,
    I am using NPGSQL to connect to postgres server.I am getting
    exception at the first statement in the try block.
    string not recognised as a vaild date time


    NpgsqlCommand command3 = new NpgsqlCommand(" SELECT * FROM table1WHERE \"col2\" = :val3", conn1);
    command3.Parame ters.Add(new NpgsqlParameter ("val3", DbType.String)) ;
    command3.Parame ters[0].Value ="werqwr";


    try
    {

    NpgsqlDataReade r dr = command3.Execut eReader();
    while (dr.Read())
    {
    for (int i = 0; i < dr.FieldCount; i++)
    {
    Console.Write(" {0} \t", dr[i]);
    }
    Console.WriteLi ne();
    }

    }

    cheers,
    SAM
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Does your select statement run in the command line?

    Comment

    Working...