Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2005, 10:09
pepelucho
 
Fecha de Ingreso: enero-2002
Ubicación: Callao - Perú
Mensajes: 1.127
Antigüedad: 22 años, 4 meses
Puntos: 0
Pregunta Error con el SQLDATAREADER

Hola, al hacer una consulta con el datareader me sale error, este es el codigo que uso.. ExecuteReader requires an open and available Connection. The connection's current state is Closed.

'la conexion la tengo en una clase
Dim cn As New SqlConnection(ConnectionString)
cmd As SqlCommand
cmd = New SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = "Select monto from interes where ano_interes='" & txtano.Text & "' and id_auto=" & ddltipo.SelectedItem.Value & " and id_Seguro=1"
cmd.Connection = cn
Dim drd As SqlDataReader
drd = cmd.ExecuteReader
If drd.Read Then
tasa = drd.GetValue(0)
End If
__________________
SaLuDoS dE:
PePeLuChO dEl PeRú PaRa El MuNdO