
09/08/2004, 13:45
|
| | Fecha de Ingreso: mayo-2004
Mensajes: 183
Antigüedad: 20 años, 11 meses Puntos: 0 | |
hola Ya que el archivo se encuentre en el servidor. Debes hacer lo siguiente:
1. Desglosar el archivo por medio de tokens, yo tengo una funcion que hace esto y te lo separa. No es mia, pero me ayudado bastante.
Function Tokenize(byVal TokenString, byRef TokenSeparators())
Dim NumWords, a()
NumWords = 0
Dim NumSeps
NumSeps = UBound(TokenSeparators)
Do
Dim SepIndex, SepPosition
SepPosition = 0
SepIndex = -1
for i = 0 to NumSeps-1
' Find location of separator in the string
Dim pos
pos = InStr(TokenString, TokenSeparators(i))
' Is the separator present, and is it closest to the beginning of the string?
If pos > 0 and ( (SepPosition = 0) or (pos < SepPosition) ) Then
SepPosition = pos
SepIndex = i
End If
Next
' Did we find any separators?
If SepIndex < 0 Then
' None found - so the token is the remaining string
redim preserve a(NumWords+1)
a(NumWords) = TokenString
Else
' Found a token - pull out the substring
Dim substr
substr = Trim(Left(TokenString, SepPosition-1))
' Add the token to the list
redim preserve a(NumWords+1)
a(NumWords) = substr
' Cutoff the token we just found
Dim TrimPosition
TrimPosition = SepPosition+Len(TokenSeparators(SepIndex))
TokenString = Trim(Mid(TokenString, TrimPosition))
End If
NumWords = NumWords + 1
loop while (SepIndex >= 0)
Tokenize = a
End Function
Te muestro un ejemplo de como pasarle parametros a la funcion.
dim seps(1)
seps(0)=';'
dim linea 'la que lees del archivo
res=Tokenize(linea, seps)
For i=1 to UBound(res)
response.write(res(i)
next
end if
como veras en res(i) se queda ya los campos separados, ahora bien tu debes declarar la consulta, la cual no se como sea.
Última edición por masterboy6666; 09/08/2004 a las 13:47 |