I was going to post a long message but I found the problem. Yet I do not know how to correct it efficiently.
I have a request to my DB using that kind of code :
With SQL_Commande
valiSqlConnection(True)
' Configure SQL_Commande.
.Connection = SQL_Connection
.CommandText = "_Fonctions_valiUtilInfo"
.CommandType = Data.CommandType.StoredProcedure
.Parameters.Clear()
Dim SQL_Lecteur As SqlDataReader = SQL_Commande.ExecuteReader
If SQL_Lecteur.Read And Not IsDBNull(SQL_Lecteur(0)) Then Return SQL_Lecteur(0) Else Return Nothing
valiSqlConnection(False, SQL_Lecteur)
End With
My problem is that I need use a function within the "With" section, and that function calls a request on the DB then closes the query, and when it gets back at executing the remaining part of the code, it stop saying that the query is closed and cannot be excuted anymore. How can I nest a query within an other one without having this problem?
Adding a more user friendly structure explaination :
SQL Request #1
Function A ( Extracted Value #1 )
Extracted Value #2
Extracted Value #3
Closing SQL Resquest #1
Function A ( Value #1 )
SQL Request #A
Returning Extracted Value #A
Closing SQL Request #A
It closes both request. I need to keep the request open. Of course I could change the order, but that is just by passing the problem. As well I know I could redesign the TSQL request to correct the problem, but for now, I do not have the time to do that since the request is very large and would need close to complete redesign.
Thank you!
|||
Finaly, due to lack of answer I remade the entire SQL request.
No comments:
Post a Comment