How many DataReader can be associated a one Connection?
I've this code:
---------------------
SQL = "select ac.cod_asig_cell, c.numero_cell from asig_cel " & _
"where (l.cod_cliente = '2') and (ac.fecha_asig >= '" & _
from_date.SelectedDate.ToString("yyyyMMdd") & _
"' and ac.fecha_asig <= '" & to_date.SelectedDate.ToString("yyyyMMdd") & "')"
conectarBD(cnn) --> connect to database
cmd.CommandText = SQL
cmd.Connection = cnn
dr1 = cmd.ExecuteReader
If Not dr1.IsDBNull(0) And dr1.HasRows Then
Do While (dr1.Read)
dataRow1 = dataTable1.NewRow
dataRow1("codigo") = dr1("cod_asig_cell")
dataRow1("celular") = dr1("numero_cell")
dataRow1("habitacion") = dr1("cod_usuario")
SQL = "select count(tipo_llamada) from llamadas where " & _
"cod_asig_cell = '" & _
dr1("cod_asig_cell") & "' group by tipo_llamada order by tipo_llamada"
cmd.CommandText = SQL
cmd.Connection = cnn
dr2 = cmd.ExecuteReader
If Not dr2.IsDBNull(0) And dr2.HasRows Then
dataRow1("LlamadasLOCLDN") = dr2(0)
dr2.Read()
dataRow1("LlamadasLDI") = dr2(0)
Else
dataRow1("LlamadasLOCLDN") = 0
dataRow1("LlamadasLDI") = 0
End If
dr2.Close()
dataTable1.Rows.Add(dataRow1)
Loop
----------
But when trying run this, i get this error message:
"There is already an open DataReader associated with this Connection which must be closed first."
1. Can't I connect two or more dataReader in one connection?
Subject
Written By
Posted
How many DataReader can be associated a one Connection?
December 27, 2004 05:44PM
December 28, 2004 09:55AM
December 28, 2004 11:00PM
December 29, 2004 08:26AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.