insertar fechas en asp
buenas, estoy creando un modulo con asp para tener unas estadisticas online que produce un pc de la red el caso es que tengo todo terminado solo necesito saber como introducir el codigo que tengo en VBScript dentro de una pagina asp y que se relacione con los botones e imput que he creado en otra pagina html, trabajando con los datos insertados en el imput... alguien sabe como hacerlo¿?
No te he entendido muy bien, si dices que tienes el código vbscript sólo has de meterla en la página ¿?.
Has de explicarte mejor para que comprenda lo que quieres hacer para poder ayudarte
Has de explicarte mejor para que comprenda lo que quieres hacer para poder ayudarte
la pagina en html tiene el siguiente codigo
<FORM NAME=BotonCargar METHOD=GET ACTION="botoncargar.asp">
<font size="-4" face="Arial, Helvetica, sans-serif"><strong><em>
FECHA INICIO:</em></strong></font>
<input type=text name="FechaInicio" size="10" maxlength="10"><p>
<font size="-4" face="Arial, Helvetica, sans-serif"><strong><em>
FECHA FINAL:</em></strong></font>
<input type=text name="FechaFinal" size="10" maxlength="10"><p>
<input name="botoncargar" TYPE="submit" value="Actualizar Datos">
</FORM>
y en la pagina asp he insertado un codigo en VBScript (tal cual) que funciona correctamente dentro de un formulario de Access con el siguiente codigo:
<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<html>
<head>
</head>
<body>
<% Option Compare Database
\' Variables Globales
Dim Dia, Mes, Anno
%>
<%
Private Sub BotonCargar_Click()
Dim MiNombre As String
Dim FechaDesde, FechaHasta, FechaAux As Date
Dim MiPath As String
Dim Meses(1000), Mes, Anno
Dim Indice, IndiceAux As Integer
Dim Existen As Boolean
Dim DirOrig As String
\' Dim bLlSal As Boolean
\' On Error GoTo Err1
Existen = True
\' bLlSal = False
TextBoxPath.SetFocus
DirOrig = TextBoxPath.Text
\' Eliminamos las tablas si éstas existen
If (FileExists("c:\LLENT.txt")) Then Borrar "c:\LLENT.txt", Form_Informes, False, False, False
\' Rellenamos los campos si estos están vacios
TextBoxPathFechaInicio.SetFocus
If (TextBoxPathFechaInicio.Text = "") Then TextBoxPathFechaInicio.Text = Date
FechaDesde = TextBoxPathFechaInicio.Text
TextBoxPathFechaFinal.SetFocus
If (TextBoxPathFechaFinal.Text = "") Then TextBoxPathFechaFinal.Text = Date
FechaHasta = TextBoxPathFechaFinal.Text
Indice = 0
FechaAux = FechaDesde
Mes = Month(FechaAux)
Anno = Year(FechaAux)
\' Almacenamos los nombres de los directorios que recorreremos
While (Anno < Year(FechaHasta)) Or (Anno = Year(FechaHasta) And Mes <= Month(FechaHasta))
Meses(Indice) = CStr(Anno) + Format(CStr(Mes), "00")
Mes = Mes + 1
If (Mes = 13) Then
Mes = 1
Anno = Anno + 1
End If
Indice = Indice + 1
Wend
TextBoxPath.SetFocus
MiPath = TextBoxPath.Text
ProgressBar1.Min = 0
ProgressBar1.Max = 1
For IndiceAux = 0 To Indice - 1
Mes = Meses(IndiceAux)
TextBoxPath.SetFocus
MiPath = TextBoxPath.Text \' Establece la ruta.
MiPath = "\\192.168.0.102\estadis" + "\" + Mes + "\" \'MiPath
ProgressBar1.Value = 0
ProgressBar1.Max = 1
With Application.FileSearch
.NewSearch
.LookIn = MiPath
.SearchSubFolders = True
.FileName = ".TXT"
.MatchAllWordForms = True
If .Execute() > 0 Then
ProgressBar1.Max = .FoundFiles.Count
End If
End With
MiNombre = Dir(MiPath, vbDirectory) \' Recupera la primera entrada.
Do While MiNombre <> "" \' Inicia el proceso.
If (GetAttr(MiPath & MiNombre) <> vbDirectory And Right(MiNombre, 4) = ".TXT") Then
ProgressBar1.Value = ProgressBar1.Value + 1
FechaAux = FechaEstCTI(Left(Right(MiNombre, 12), 8))
If (FechaAux >= FechaDesde And FechaAux <= FechaHasta) Then
Select Case Mid(MiNombre, 5, 3)
Case "LLE"
If (Mid(MiNombre, 5, 8) <> "LLE_PABX") Then
CopiarFichero MiPath & MiNombre, "C:\LLENT.txt"
End If
End Select
End If
End If \' solamente si representa un directorio.
MiNombre = Dir \' Obtiene siguiente entrada.
Loop
Next IndiceAux
If Not (FileExists("c:\LLENT.txt")) Then
Dim Fs1, A1 As Object
Set Fs1 = CreateObject("Scripting.FileSystemObject")
Set A1 = Fs1.CreateTextFile("c:\LLENT.txt", True)
A1.Close
End If
If (Existen = False) Then
MsgBox "No se encontraron datos", vbCritical
Else
MsgBox "Datos Actualizados Correctamente", vbInformation
DoCmd.RunSQL "UPDATE CONF SET RUTAFICHEROS = \'" & DirOrig & "\'"
End If
Exit Sub
End Sub
%>
</body>
</html>
todo esto tiene que realizar la funcion de que el cliente introduce una fecha inicial y otra final y el codigo asp recoje mediante esas fechas los ficheros correspondientes de el path que se le indica y se envian a un fichero llamado C:\LLEN.TXT para que el Access muestre todas sus consultas actualizadas segun la fecha indicada, no se si esto puede funcionar asi¿?
<FORM NAME=BotonCargar METHOD=GET ACTION="botoncargar.asp">
<font size="-4" face="Arial, Helvetica, sans-serif"><strong><em>
FECHA INICIO:</em></strong></font>
<input type=text name="FechaInicio" size="10" maxlength="10"><p>
<font size="-4" face="Arial, Helvetica, sans-serif"><strong><em>
FECHA FINAL:</em></strong></font>
<input type=text name="FechaFinal" size="10" maxlength="10"><p>
<input name="botoncargar" TYPE="submit" value="Actualizar Datos">
</FORM>
y en la pagina asp he insertado un codigo en VBScript (tal cual) que funciona correctamente dentro de un formulario de Access con el siguiente codigo:
<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<html>
<head>
</head>
<body>
<% Option Compare Database
\' Variables Globales
Dim Dia, Mes, Anno
%>
<%
Private Sub BotonCargar_Click()
Dim MiNombre As String
Dim FechaDesde, FechaHasta, FechaAux As Date
Dim MiPath As String
Dim Meses(1000), Mes, Anno
Dim Indice, IndiceAux As Integer
Dim Existen As Boolean
Dim DirOrig As String
\' Dim bLlSal As Boolean
\' On Error GoTo Err1
Existen = True
\' bLlSal = False
TextBoxPath.SetFocus
DirOrig = TextBoxPath.Text
\' Eliminamos las tablas si éstas existen
If (FileExists("c:\LLENT.txt")) Then Borrar "c:\LLENT.txt", Form_Informes, False, False, False
\' Rellenamos los campos si estos están vacios
TextBoxPathFechaInicio.SetFocus
If (TextBoxPathFechaInicio.Text = "") Then TextBoxPathFechaInicio.Text = Date
FechaDesde = TextBoxPathFechaInicio.Text
TextBoxPathFechaFinal.SetFocus
If (TextBoxPathFechaFinal.Text = "") Then TextBoxPathFechaFinal.Text = Date
FechaHasta = TextBoxPathFechaFinal.Text
Indice = 0
FechaAux = FechaDesde
Mes = Month(FechaAux)
Anno = Year(FechaAux)
\' Almacenamos los nombres de los directorios que recorreremos
While (Anno < Year(FechaHasta)) Or (Anno = Year(FechaHasta) And Mes <= Month(FechaHasta))
Meses(Indice) = CStr(Anno) + Format(CStr(Mes), "00")
Mes = Mes + 1
If (Mes = 13) Then
Mes = 1
Anno = Anno + 1
End If
Indice = Indice + 1
Wend
TextBoxPath.SetFocus
MiPath = TextBoxPath.Text
ProgressBar1.Min = 0
ProgressBar1.Max = 1
For IndiceAux = 0 To Indice - 1
Mes = Meses(IndiceAux)
TextBoxPath.SetFocus
MiPath = TextBoxPath.Text \' Establece la ruta.
MiPath = "\\192.168.0.102\estadis" + "\" + Mes + "\" \'MiPath
ProgressBar1.Value = 0
ProgressBar1.Max = 1
With Application.FileSearch
.NewSearch
.LookIn = MiPath
.SearchSubFolders = True
.FileName = ".TXT"
.MatchAllWordForms = True
If .Execute() > 0 Then
ProgressBar1.Max = .FoundFiles.Count
End If
End With
MiNombre = Dir(MiPath, vbDirectory) \' Recupera la primera entrada.
Do While MiNombre <> "" \' Inicia el proceso.
If (GetAttr(MiPath & MiNombre) <> vbDirectory And Right(MiNombre, 4) = ".TXT") Then
ProgressBar1.Value = ProgressBar1.Value + 1
FechaAux = FechaEstCTI(Left(Right(MiNombre, 12), 8))
If (FechaAux >= FechaDesde And FechaAux <= FechaHasta) Then
Select Case Mid(MiNombre, 5, 3)
Case "LLE"
If (Mid(MiNombre, 5, 8) <> "LLE_PABX") Then
CopiarFichero MiPath & MiNombre, "C:\LLENT.txt"
End If
End Select
End If
End If \' solamente si representa un directorio.
MiNombre = Dir \' Obtiene siguiente entrada.
Loop
Next IndiceAux
If Not (FileExists("c:\LLENT.txt")) Then
Dim Fs1, A1 As Object
Set Fs1 = CreateObject("Scripting.FileSystemObject")
Set A1 = Fs1.CreateTextFile("c:\LLENT.txt", True)
A1.Close
End If
If (Existen = False) Then
MsgBox "No se encontraron datos", vbCritical
Else
MsgBox "Datos Actualizados Correctamente", vbInformation
DoCmd.RunSQL "UPDATE CONF SET RUTAFICHEROS = \'" & DirOrig & "\'"
End If
Exit Sub
End Sub
%>
</body>
</html>
todo esto tiene que realizar la funcion de que el cliente introduce una fecha inicial y otra final y el codigo asp recoje mediante esas fechas los ficheros correspondientes de el path que se le indica y se envian a un fichero llamado C:\LLEN.TXT para que el Access muestre todas sus consultas actualizadas segun la fecha indicada, no se si esto puede funcionar asi¿?