Foros del Web » Programando para Internet » ASPX (.net) »

No se ha inicializado la propiedad ConnectionString.

Estas en el tema de No se ha inicializado la propiedad ConnectionString. en el foro de ASPX (.net) en Foros del Web. Hola: Estoy haciendo la validación de un usuario para la seguridad de un sistema. Este es el procedimiento que estoy haciendo: Código PHP:          Protected  ...
  #1 (permalink)  
Antiguo 24/01/2008, 14:33
Avatar de CieloEterno  
Fecha de Ingreso: marzo-2006
Ubicación: México
Mensajes: 52
Antigüedad: 18 años, 1 mes
Puntos: 0
Pregunta No se ha inicializado la propiedad ConnectionString.

Hola:

Estoy haciendo la validación de un usuario para la seguridad de un sistema.

Este es el procedimiento que estoy haciendo:

Código PHP:
        Protected Sub validar_Click(ByVal sender As ObjectByVal e As System.EventArgs)

            
Dim rsLectura As System.Data.Odbc.OdbcDataReader
            
            Dim lsLRsql 
As String "select usuario from tsm_usuario where usuario='" 
        
txt_usuario.Text.Trim "' and clave='" txt_passwd.Text.Trim "' and activo=1"

            
Response.Write("<font color=orange size=4>Query " lsLRsql "</font><br>")
            Try
                
ocdJL_Command.Dispose()
                
ocdJL_Command cn.putComand(lsLRsqlcLRcon)
                
Response.Write("<font color=gray size=4>AQUI-<br>")
                
rsLectura ocdJL_Command.ExecuteReader()
                Try
                    
rsLectura ocdJL_Command.ExecuteReader()
                Catch 
ex As Exception
                    
[B]rsLectura.Close() [/B]
                    
                    
Response.Write("<font color=purple size=4>VEAMOS-" ex.Message "<br>")
                    
rsLectura ocdJL_Command.ExecuteReader()

                
End Try
                
                If 
rsLectura.Read Then
                    Session
("vusuario") = rsLectura.Item("usuario")
                    
Session.Timeout 30
                    Response
.Write("<font color=red size=4>SESSION<br>")
                
End If
        
            Catch 
ex As Exception
                Session
("vusuario") = False
                Response
.Write("<font color=purple size=4>NO * SESSION-" ex.Message "<br>")
            
End Try


            If 
Session("vusuario") = True Then
                Response
.Write("<font color=darkblue size=4>Existe la sesión del 
            usuario</font>"
)
            Else
                
Response.Write("<font color=green size=4>NO Existe la sesión del 
            usuario</font>"
)
            
End If
            
        
End Sub 

En el momento en que cierro la conexion en el catch; obtengo:


Y lo que me manda en pantalla es esto:



La verdad, soy nueva en este tipo de programación, pero si alguien me puede decir que tipo de declaración o cómo debe ser hecha para rs Lectura, se los agradecería mucho.


Tengo definidas las variables que estoy ocupando en un archivo, declaradas asi:
Public cLRcon As New OdbcConnection


Gracias
__________________
Aquel que no tiene nada por lo cual morir, no tiene nada por que vivir

Última edición por CieloEterno; 24/01/2008 a las 18:10 Razón: Cambiar título de la pregunta.
  #2 (permalink)  
Antiguo 24/01/2008, 18:09
Avatar de CieloEterno  
Fecha de Ingreso: marzo-2006
Ubicación: México
Mensajes: 52
Antigüedad: 18 años, 1 mes
Puntos: 0
No se ha inicializado la propiedad ConnectionString.

He realizado algunas modificaciones:

Código PHP:
        Private Sub validar_Click(ByVal sender As ObjectByVal e As System.EventArgs)
            
            
Dim rsLectura As System.Data.Odbc.OdbcDataReader
            Dim query 
As String "select usuario from tsm_usuario where usuario='" txt_usuario.Text.Trim "' and clave='" txt_passwd.Text.Trim "' and activo=1"
            
            
Response.Write("<font color=orange size=4>Query " query "</font><br>")
            
Response.Write("<font color=orange size=4>ENTRA0 - abierto - *" cLRcon.State "* -  cerrado</font><br>")
            
            Try
                
Response.Write("<font color=orange size=4>ENTRA1 - abierto - *" cLRcon.State "* -  cerrado</font><br>")
                
cLRcon.Close()
                
Response.Write("<font color=orange size=4>ENTRA2 - abierto - *" cLRcon.State "* -  cerrado</font><br>")
                If 
cLRcon.State False Then
                    Response
.Write("<font color=orange size=4>ENTRA3 - cerrado -" cLRcon.State "- abierto</font><br>")
                    
''cLRcon.ConnectionString 
                    
                    
Response.Write("<font color=orange size=4>ENTRA5 - cerrado - abierto</font><br>")
                    
cLRcon.Open()
                    
Response.Write("<font color=orange size=4>ENTRA6 - cerrado - abierto</font><br>")
                Else
                    
Response.Write("<font color=orange size=4>ENTRA4 - cerrado - abierto</font><br>")
                
End If
                
                
ocdJL_Command.Dispose()
                
ocdJL_Command cn.putComand(querycLRcon)
                
Response.Write("<font color=gray size=4>AQUI-<br>")
                Try
                    
rsLectura ocdJL_Command.ExecuteReader()
                Catch 
ex As Exception
                    Response
.Write("<font color=purple size=4>OJOS-" ex.Message "<br>")
                    
rsLectura.Close()
                    
Response.Write("<font color=purple size=4>VEAMOS-" ex.Message "<br>")
                    
rsLectura ocdNA_Command.ExecuteReader()
                
End Try
                
                While 
rsLectura.Read
                    Session
("vusuario") = rsLectura.Item("usuario")
                    
Session.Timeout 30
                    Session
.Abandon()
                    
Response.Write("<font color=red size=4>SESSION<br>")
                
End While
                
                
'rsLectura.Close()
                
            Catch ex As Exception
                Response.Write("<font color=purple size=4>ULTIMO CATCH<br>")
                Response.Write("<font color=purple size=4>OJOS-**********<br>" + ex.Message + "<br>" + query + "--<br>")
            End Try
            

            '
If rsLectura.Read Then
            
'Session("vusuario") = rsLectura.Item("usuario")
            '
Session.Timeout 30
            
'Session.Abandon()
            '
Response.Write("<font color=red size=4>SESSION<br>")
            
'End If
            '
rsLectura.Close()
            
            If 
Session("vusuario") = True Then
                Response
.Write("<font color=darkblue size=4>Existe la sesión del usuario</font>")
            Else
                
Response.Write("<font color=green size=4>NO Existe la sesión del usuario</font>")
            
End If
            
        
End Sub 


Ahora, el error que obtengo es el siguiente:
No se ha inicializado la propiedad ConnectionString.

Al imprimir en pantalla, se muestran los siguientes avisos (response.write) que estoy colocando:

Query select usuario from tsm_usuario where usuario='administrador' and clave='123' and activo=1
ENTRA0 - abierto - *0* - cerrado
ENTRA1 - abierto - *0* - cerrado
ENTRA2 - abierto - *0* - cerrado
ENTRA3 - cerrado -0- abierto
ENTRA5 - cerrado - abierto
ULTIMO CATCH
OJOS-**********
No se ha inicializado la propiedad ConnectionString.
select usuario from tsm_usuario where usuario='administrador' and clave='123' and activo=1--
NO Existe la sesión del usuario


- Alguien sabe como Inicializar la propiedad ConnectionString? O cómo podrían soluciar este problema???
__________________
Aquel que no tiene nada por lo cual morir, no tiene nada por que vivir
  #3 (permalink)  
Antiguo 25/01/2008, 19:00
Avatar de CieloEterno  
Fecha de Ingreso: marzo-2006
Ubicación: México
Mensajes: 52
Antigüedad: 18 años, 1 mes
Puntos: 0
De acuerdo Resolución

Pues finalmente pude dar con la solución, agregué las siguentes líneas y todo quedo perfecto:

Código PHP:
        Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.Load
            cLRcon 
cn.GetConnection()
            
cLRcon.Open()
        
End Sub 

¡¡¡Saludos¡¡¡
__________________
Aquel que no tiene nada por lo cual morir, no tiene nada por que vivir
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:54.