Recommended: ASP exports data from the database to the EXCEL table ASP instance code directly exports the data in the database to the EXCEL spreadsheet. !--#include file=../conn.asp-- % dim s,sql,filename,fs,myfile,x Set fs = server.CreateObject(scripting.filesystemobject) '--Suppose you want the generated EXCEL file to be stored as follows filename = Server.
Due to different properties of various fields, the methods to determine whether a field is empty are also different.
The following is a general function, which avoids the pain of field type.
'Check a variable isn't empty
Function IsBlank(ByRef TempVar)
'by default, assume it's not blank
IsBlank = False
'now check by variable type
Select Case VarType(TempVar)
'Empty & Null
Case 0, 1
IsBlank = True
'String
Case 8
If Len(TempVar) = 0 Then
IsBlank = True
End If
'Object
Case 9
tmpType = TypeName(TempVar)
If (tmpType = Nothing) Or (tmpType = Empty) Then
IsBlank = True
End If
'Array
Case 8192, 8204, 8209
'does it have at least one element?
If UBound(TempVar) = -1 Then
IsBlank = True
End If
End Select
End Function
Application example:
If IsBlank(rs(upic)) Then
upicurl=/images/nonepic.jpg
Else
upicurl=rs(upic)
End If
Share: ASP generates the code for the picture with the phone number Function: Generate the phone number on the page to image format. % Call Com_CreatValidCode(Request.QueryString(tel)) Public Sub Com_CreatValidCode(pTel) '----------禁止缓存Response.Expires = 0 Response.AddHeader Pragma,no-cache Response.AddHeader cache-ctro