[Mono-list] Problem with Npgsql
Adrian Dinu
adrian.dinu at dreamsoftware.ro
Fri Sep 23 09:42:42 EDT 2005
Before cnn.Close() do a dr.Close() too.
On Fri, 2005-09-23 at 13:35 +0000, Willngton Roque wrote:
> I'm try using Mono with Npgsql and have this problem.
> I'm try reboot my pc and de problem percist.
>
> Unhandled Exception: System.InvalidOperationException: DataReader
> positioned beyond end of result set.
> in <0x00092> Npgsql.NpgsqlDataReader:CheckHaveRow ()
> in <0x00058> Npgsql.NpgsqlDataReader:GetValue (Int32 Index)
> in <0x00051> Npgsql.NpgsqlDataReader:get_Item (System.String name)
> in <0x000aa> MonoSql:Main (System.String[] args)
>
> Help me?
>
> Ubuntu 5.04 + Mono JIT compiler version 1.1.9
>
> Thanks
>
> ---code
>
> // created on 23/9/2005 at 08:43
> using System;
> using System.Data;
> using Npgsql;
>
> class MonoSql
> {
> public static void Main(string[] args)
> {
> string strConn = "Server=localhost;"+
> "Port=5432;"+
> "User ID=postgres;"+
> "Password=;"+
> "Database=teste;";
>
> NpgsqlConnection cnn = new NpgsqlConnection(strConn);
>
> string sql = "Select * from teste order by nome";
> NpgsqlCommand cmd = new NpgsqlCommand(sql, cnn);
>
> cnn.Open();
>
> NpgsqlDataReader dr = cmd.ExecuteReader();
>
>
> while (dr.Read());
> {
> Console.WriteLine("Nome: " + dr["nome"]);
> }
>
> cnn.Close();
>
> Console.WriteLine("Para finalizar precione qq tecla");
>
> Console.ReadLine();
>
> }
> }
>
>
> --
>
>
> --
> Willngton Roque
> E-mail: willngton at gmail.com
> MSN: willngton at hotmail.com
> ICQ: 82484019
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
________________________________________________________________________
Adrian Dinu
Technical Manager
Dream Team Software
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20050923/2de82fc9/attachment-0001.html
More information about the Mono-list
mailing list