24/08/2012, 12:06
|
| | Fecha de Ingreso: junio-2011
Mensajes: 329
Antigüedad: 13 años, 5 meses Puntos: 2 | |
error: There is already an open DataReader alguien sabe por que marca este error:
There is already an open DataReader associated with this Command which must be closed first.
este es mi codigo
Dim sqlCon As SqlConnection = New SqlConnection("Data Source=192.168.10.20;Initial Catalog=Papeleria;User ID=sa;Password=stm01;MultipleActiveResultSets=True ;")
sqlCon.Open()
Dim sqlCmd As SqlCommand = New SqlCommand
sqlCmd.CommandText = "select precio from articulos where descripcion = '" & Label6.Text.Trim() & "'"
sqlCmd.Connection = sqlCon
Label65.Text = sqlCmd.ExecuteScalar.ToString
sqlCon.Close()
'-----------------------
Dim sqlCon1 As SqlConnection = New SqlConnection("Data Source=192.168.10.20;Initial Catalog=Papeleria;User ID=sa;Password=stm01;MultipleActiveResultSets=True ;")
sqlCon1.Open()
Dim sqlCmd1 As SqlCommand = New SqlCommand
sqlCmd1.CommandText = "select precio from articulos where descripcion = '" & Label7.Text.Trim() & "'"
sqlCmd1.Connection = sqlCon1
Dim leerbd As SqlDataReader = sqlCmd1.ExecuteReader()
If leerbd.Read <> False Then
Label66.Text = sqlCmd1.ExecuteScalar.ToString
Else
Label66.Text = ""
End If
sqlCon1.Close() |