if i run this 2 or more time wait 2 second ir crash the xojo app web no idea way and no error code
Dim data As String
Dim mReport AS New VReport
Dim RepStrConn As String
Dim P1,P2,P3,P4,P5,P6 As Boolean
Dim fun1,MyQuery,SqlStr01 As String
Dim x as Integer
P1=False
P2=False
P3=False
P4=False
P5=False
P6=False
MyQuery=""
MyQuery=SelecRep(PopReportes.Text.Trim)
If RepCall.len=0 Then Exit Sub
If Checkbox1.Value=True Then
fun1="0"
Else
fun1="1"
End If
TxtNumCliente.Text=ReplaceAll(TxtNumCliente.Text,"'",""
TxtDateFrom.Text=ReplaceAll(TxtDateFrom.Text,"'",""
TxtDateTo.Text=ReplaceAll(TxtDateTo.Text,"'",""
HTMLViewer1.LoadPage("<html></html>"
If InStr(MyQuery,"f1" > 0 Then
P1=True
End If
If InStr(MyQuery,"f2" > 0 Then
P2=True
End If
If InStr(MyQuery,"c1" > 0 Then
P3=True
End If
If InStr(MyQuery,"p1" > 0 Then // Pueblo o Ciudad
P4=True
End If
If InStr(MyQuery,"s1" > 0 Then /// Estatus de socio 0=Activo y 1=Inactivo
P5=True
End If
If InStr(MyQuery,"m1" > 0 Then /// Marca de Gasolina
P6=True
End If
If MyQuery.Trim.Len=0 Then
MsgBox "**** Report Name No Found ****"
Exit Sub
End If
If (P1=True) or (P2=true) Then
If (TxtDateFrom.Text.Trim.len > 7) and (P1=True) Then
MyQuery=Replace(MyQuery,"f1",TxtDateFrom.text.Trim)
Else
If (P1=True) Then
MsgBox "*** Entre la Fecha 1 ***"
Exit Sub
End If
End If
If (TxtDateTo.Text.Len > 7) and (P2=true) Then
MyQuery=Replace(MyQuery,"f2",TxtDateTo.Text)
Else
If (P2=true) Then
MsgBox "*** Entre la Fecha 2 ***"
Exit Sub
End If
End If
End If
If P3=True Then
If TxtNumCliente.Text.Trim<>"" Then
MyQuery=Replace(MyQuery,"c1",TxtNumCliente.text.Trim)
Else
MsgBox "*** Entre Num. Cliente ***"
Exit Sub
End If
End If
If P4=True Then
//If TxtNumCaja.Text.Trim<>"" Then
//MyQuery=Replace(MyQuery,"caja1",TxtNumCaja.text.Trim)
//Else
//MsgBox "*** Entre Num. Cliente ***"
//Exit Sub
//End If
End If
If P5=True Then
If fun1.len=1 Then
MyQuery=Replace(MyQuery,"s1",fun1.Trim)
Else
MsgBox "*** Entre Num. Cliente ***"
Exit Sub
End If
End If
If P6=True Then
If fun1.len=1 Then
MyQuery=Replace(MyQuery,"m1",PopMarcas.Text.Trim)
Else
MsgBox "*** Entre Num. Cliente ***"
Exit Sub
End If
End If
If MyQuery.Trim="" Then Exit Sub
HTMLViewer1.LoadPage("<html></html>"
#if DebugBuild Then
RepStrConn="mssql://host='localhost' port='1433' dbname='ADG' user='adgadmin' password='dragon64goku15'"
#Else
//RepStrConn="mssql://host='localhost\\SQLEXPRESS' port='1433' dbname='ADG' user='adgadmin' password='11'"
RepStrConn="mssql://host='localhost\\SQLEXPRESS' port='1433' dbname='ADG' user='adgadmin' password='11'"
#endif
projectPath = GetFolderItem( "adgreports.vsp" )
mProject = new VProject(projectPath)
mProject.Open()
if mProject <> nil then
session.MSDB.vCounts = mProject.ReportCount()
end if
Button1.Enabled=False
Button2.Enabled=False
try
mReport = mProject.MakeNewReport(RepCall, RepStrConn,MyQuery)
catch e as VException
dim errNumber as Integer = e.ErrorNumber
dim errString as String = e.Message
MsgBox "** Make Report error " + errString
MsgBox "** Make Report error num =" + Str(errNumber)
end
Button1.Enabled=True
Button2.Enabled=True
If sPDF=False Then
try
data = mReport.PrintToBuffer(EVReportPrintType.kToHTML, 1 )
Exception err as VException
dim errNumber as Integer = err.ErrorNumber
dim errString as String = err.Message
MsgBox errString
end
HTMLViewer1.LoadPage(data)
Else
try
data = mReport.PrintToBuffer(EVReportPrintType.kToPDF, 1)
Exception err as VException
dim errNumber as Integer = err.ErrorNumber
dim errString as String = err.Message
MsgBox errString
end
Session.mPDF = New WebFile
Session.mPDF.MimeType = "application/pdf"
Session.mPDF.ForceDownload = True
Session.mPDF.FileName = "report.pdf"
Session.mPDF.Data = data
ShowURL( Session.mPDF.URL )
End If
mProject.Close
mReport=nil
projectPath=nil
mProject=nil
For x=1 to 2500
Next