Jorge
For one thing you are not closing your datareader.
-reggie
> -----Original Message-----
> From: Jorge Bastos [mailto:mysql.jorge@stripped]
> Sent: Tuesday, February 22, 2005 6:38 AM
> To: dotnet@stripped; Reggie Burnett
> Subject: Wierd problem
>
> DecimalReggie,
> I got a serius issue here, i'm gonna try to reproduce some
> code to you take do the same and try, this is with driver 1.0.4
>
>
> ########## example 1 ##########
> dim mycon as new mysqlconnection("connection string") dim sql
> as string = "select max(id) from tbl_name"
> dim mycmd as new mysqlcommand(sql , mycon) dim myrd as
> mysqldatareader myrd=mycmd.executereader
>
> if myrd.read
> msgbox "got some results"
> else
> msgbox "has a null result"
> end if
>
> mycon.close()
> mycmd.dispose()
> ########## example 1 ##########
>
> In the abobe example everything works fine because the max
> function will return the last value of the column "id"
>
>
> ########## example 2 ##########
> dim mycon as new mysqlconnection("connection string")
> dim sql as string = "select max(id) from tbl_name where
> id='laskdjflksdj'" <------ this where statment is
> impossible, mysql'll return a null value, ---> [NULL]
> dim mycmd as new mysqlcommand(sql , mycon) dim myrd as
> mysqldatareader myrd=mycmd.executereader
>
> if myrd.read
> msgbox "got some results"
> else
> msgbox "has a null result"
> end if
>
> mycon.close() <----------- like i'll have the value [NULL]
> returned, i get an error here, at the end of the email i show
> the output
> mycmd.dispose()
> ########## example 2 ##########
>
> This was not happening with the previous drivers versions, i
> already had to change a bit of code to handle the situation.
> I'm almost sure that is something with the datareader that
> doesn't like the value [NULL] that mysql returns, can you
> confirm the driver bug and how can i resolve this?
> For now i've resolved inserting an try /catch
>
> Jorge Bastos
>
>
>
>
>
> Output:
> MySql.Data.MySqlClient.MySqlException: There is already an
> open DataReader associated with this Connection which must be
> closed first.
> at MySql.Data.MySqlClient.MySqlCommand.CheckState()
> at
> MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehav
> ior behavior)
> at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
> at MySql.Data.MySqlClient.Driver.ShowWarnings(Int32 count)
> at MySql.Data.MySqlClient.NativeDriver.ReadEOF(Boolean readPacket)
> at MySql.Data.MySqlClient.NativeDriver.OpenDataRow(Int32
> fieldCount, Boolean isBinary)
> at MySql.Data.MySqlClient.CommandResult.Consume()
> at MySql.Data.MySqlClient.MySqlDataReader.Close()
> at MySql.Data.MySqlClient.MySqlConnection.Close()
>