| Bug #73447 | Information about DataReader open when just using dataadapter | ||
|---|---|---|---|
| Submitted: | 31 Jul 2014 13:44 | Modified: | 22 Jan 2015 17:07 |
| Reporter: | Jorge Bastos | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 6.7.4 | OS: | Any |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[22 Dec 2014 17:07]
Gabriela Martinez Sanchez
hi Jorge,
I saw your code and most of it looks good to me. Although I would suggest that if your global connection is open all the time when the application is running, then you can change this part of your code:
If Not GMyCon.Ping Then
GMyCon.Open()
End If
to this:
If Not GMyCon.State == ConnectionState.Open Then
GMyCon.Open()
End If
Please give it a try and let us know if that helped to avoid the exception.
Thanks in advance!
[23 Jan 2015 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: Hi, In My project I just have two functions, one to execute all non-query tasks, and other to retrieve data, and with this, I have a global connection that is open in the app load, and closed on close, functions are: (on load) Public GMyCon as new mysqlconnection("cs with pooling=true) gmycon.open() Function SqlDataTable(ByVal sql_v As String) As DataTable SqlDataTable = New DataTable If Not GMyCon.Ping Then GMyCon.Open() End If Dim _MyDa As New MySqlDataAdapter(sql_v, GMyCon) _MyDa.Fill(SqlDataTable) _MyDa.Dispose() _MyDa = Nothing Return SqlDataTable End function Function Insert_Sql(ByVal sql_v As String, Optional ByVal mCon As MySqlConnection = Nothing) As Int32 If Not GMyCon.Ping Then GMyCon.Open() End If Dim _MyCmd As New MySqlCommand(sql_v, GMyCon) Dim sql_return As Integer = _MyCmd.ExecuteNonQuery() _MyCmd.Dispose() _MyCmd = Nothing Return sql_return End Function BUT, sometimes, after an extensive use of sqldatatable() function, I get an: MySql.Data.MySqlClient.MySqlException (0x80004005): There is already an open DataReader associated with this Connection which must be closed first. which I don't quite understand, cause I don't use the datareader. Maybe I need to clear the pool before using the dataadaptor like this? MySqlConnection.ClearPool(GMyCon) Dim _MyDa As New MySqlDataAdapter(sql_v, GMyCon) How to repeat: Using the specified functions.