R
Ricardo Magalhães
Hi,
I using this code, to connect with a paradox file with ASP.NET. The first
time its connect ok, but others times occurs the error:
"ERROR - no error information available"
I close all connection, and this error yet occurs.
Someone knows why this ?
Thanks,
Ricardo
Connection strirng content:
==================
"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox
5.X;DefaultDir=c:\inetpub\wwwroot\fafire\web\graduacao_pagamento\dados\;Dbq=c:\inetpub\wwwroot\fafire\web\graduacao_pagamento\dados\;CollatingSequence=ASCII"
Code executed when the button is clicked
============================
Private Sub CustomValidator1_ServerValidate(ByVal source As System.Object,
ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
CustomValidator1.ServerValidate
Dim PathAux As String = Server.MapPath("Web.config")
Dim PathRoot As String = PathAux.Substring(0,
PathAux.IndexOf("Web.config"))
Dim PastaDados As String = "BD" & Session("ano") &
Session("semestre")
Dim strConString As String = "Driver={Microsoft Paradox Driver
(*.db )};" & _
"DriverID=538;" & _
"Fil=Paradox 5.X;" & _
"DefaultDir=" & PathRoot & "dados\;" & _
"Dbq=" & PathRoot & "dados\;" & _
"CollatingSequence=ASCII"
Dim objConn As New Odbc.OdbcConnection(strConString)
Dim objCmd As New Odbc.OdbcCommand
Dim objDr As Odbc.OdbcDataReader
Try
objConn.Close()
objConn.Open()
objCmd.Connection = objConn
'=======================================================================
' Validando Matricula e CPF
'=======================================================================
objCmd.CommandType = CommandType.Text
objCmd.CommandText = "select
a.alu_nome,a.alu_end,a.alu_num,a.alu_compl,a.alu_bai,a.alu_cid,a.alu_est,
a.alu_cep,d.cus_cod,d.cus_nome from ALU20052 as a, MAT20052 as c, cursos as
d where c.mat_alun = '" & Trim(txtNrMatr.Text) & "' and a.alu_cpf = '" &
Trim(txtNrCPF.Text) & "' and c.mat_alun = a.alu_matr and a.alu_cur =
d.cus_cod"
objDr = objCmd.ExecuteReader(CommandBehavior.CloseConnection)
If objDr.Read Then ' Matricula Válida
Session("alu_nome") = Trim(objDr("alu_nome"))
Session("mat_alun") = Trim(txtNrMatr.Text)
Session("alun_cpf") = Trim(txtNrCPF.Text)
Session("alu_end") =
Trim(oFafire.validaDRText(objDr("alu_end")))
Session("alu_num") =
Trim(oFafire.validaDRText(objDr("alu_num")))
Session("alu_compl") =
Trim(oFafire.validaDRText(objDr("alu_compl")))
Session("alu_bai") =
Trim(oFafire.validaDRText(objDr("alu_bai")))
Session("alu_cid") =
Trim(oFafire.validaDRText(objDr("alu_cid")))
Session("alu_est") =
Trim(oFafire.validaDRText(objDr("alu_est")))
Session("alu_cep") =
IIf(Trim(oFafire.validaDRText(objDr("alu_cep"))) = "", "50000-000",
Trim(oFafire.validaDRText(objDr("alu_cep"))))
Session("cus_nome") = Trim(objDr("cus_nome"))
args.IsValid = True
Else ' Matricula Inválida
CustomValidator1.ErrorMessage = "Matricula/CPF Incorreto"
args.IsValid = False
End If
Catch ex As System.Exception
args.IsValid = False
Response.Redirect("error.aspx?MensagemTexto=" & ex.Message.Trim
& "&MensagemPaginaRetorno=mensalidade_pagamento_entrada.aspx", False)
Finally
If objConn.State = ConnectionState.Open Then objConn.Close()
objConn.Dispose()
objCmd.Dispose()
If Not IsNothing(objDr) Then objDr.Close()
objDr = Nothing
End Try
End Sub
I using this code, to connect with a paradox file with ASP.NET. The first
time its connect ok, but others times occurs the error:
"ERROR - no error information available"
I close all connection, and this error yet occurs.
Someone knows why this ?
Thanks,
Ricardo
Connection strirng content:
==================
"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox
5.X;DefaultDir=c:\inetpub\wwwroot\fafire\web\graduacao_pagamento\dados\;Dbq=c:\inetpub\wwwroot\fafire\web\graduacao_pagamento\dados\;CollatingSequence=ASCII"
Code executed when the button is clicked
============================
Private Sub CustomValidator1_ServerValidate(ByVal source As System.Object,
ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
CustomValidator1.ServerValidate
Dim PathAux As String = Server.MapPath("Web.config")
Dim PathRoot As String = PathAux.Substring(0,
PathAux.IndexOf("Web.config"))
Dim PastaDados As String = "BD" & Session("ano") &
Session("semestre")
Dim strConString As String = "Driver={Microsoft Paradox Driver
(*.db )};" & _
"DriverID=538;" & _
"Fil=Paradox 5.X;" & _
"DefaultDir=" & PathRoot & "dados\;" & _
"Dbq=" & PathRoot & "dados\;" & _
"CollatingSequence=ASCII"
Dim objConn As New Odbc.OdbcConnection(strConString)
Dim objCmd As New Odbc.OdbcCommand
Dim objDr As Odbc.OdbcDataReader
Try
objConn.Close()
objConn.Open()
objCmd.Connection = objConn
'=======================================================================
' Validando Matricula e CPF
'=======================================================================
objCmd.CommandType = CommandType.Text
objCmd.CommandText = "select
a.alu_nome,a.alu_end,a.alu_num,a.alu_compl,a.alu_bai,a.alu_cid,a.alu_est,
a.alu_cep,d.cus_cod,d.cus_nome from ALU20052 as a, MAT20052 as c, cursos as
d where c.mat_alun = '" & Trim(txtNrMatr.Text) & "' and a.alu_cpf = '" &
Trim(txtNrCPF.Text) & "' and c.mat_alun = a.alu_matr and a.alu_cur =
d.cus_cod"
objDr = objCmd.ExecuteReader(CommandBehavior.CloseConnection)
If objDr.Read Then ' Matricula Válida
Session("alu_nome") = Trim(objDr("alu_nome"))
Session("mat_alun") = Trim(txtNrMatr.Text)
Session("alun_cpf") = Trim(txtNrCPF.Text)
Session("alu_end") =
Trim(oFafire.validaDRText(objDr("alu_end")))
Session("alu_num") =
Trim(oFafire.validaDRText(objDr("alu_num")))
Session("alu_compl") =
Trim(oFafire.validaDRText(objDr("alu_compl")))
Session("alu_bai") =
Trim(oFafire.validaDRText(objDr("alu_bai")))
Session("alu_cid") =
Trim(oFafire.validaDRText(objDr("alu_cid")))
Session("alu_est") =
Trim(oFafire.validaDRText(objDr("alu_est")))
Session("alu_cep") =
IIf(Trim(oFafire.validaDRText(objDr("alu_cep"))) = "", "50000-000",
Trim(oFafire.validaDRText(objDr("alu_cep"))))
Session("cus_nome") = Trim(objDr("cus_nome"))
args.IsValid = True
Else ' Matricula Inválida
CustomValidator1.ErrorMessage = "Matricula/CPF Incorreto"
args.IsValid = False
End If
Catch ex As System.Exception
args.IsValid = False
Response.Redirect("error.aspx?MensagemTexto=" & ex.Message.Trim
& "&MensagemPaginaRetorno=mensalidade_pagamento_entrada.aspx", False)
Finally
If objConn.State = ConnectionState.Open Then objConn.Close()
objConn.Dispose()
objCmd.Dispose()
If Not IsNothing(objDr) Then objDr.Close()
objDr = Nothing
End Try
End Sub