Papillon Embroidery
<%
' ========================================================================================================================================
' Function to check file Existance
' ========================================================================================================================================
Function IsFileExists(byVal FileName)
If FileName = "" Then
IsFileExists = False
Exit Function
End If
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists( FileName ) = True Then
IsFileExists = True
Else
IsFileExists = False
End If
Set objFSO = Nothing
End Function
On Error Resume Next
' ======================================================
' Open database connection and recordset
Dim objConn, objRS, ConnString
ConnString = "Driver={MySQL};SERVER=" & "localhost" & ";DATABASE=" & "web93-pap123" & ";UID=" & "web93-pap123" & ";PWD=" & "libra27"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open ConnString
'objConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/products.mdb")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = objConn
objRS.Source = "SELECT * FROM tblCategory ORDER BY CategoryOrder ASC;"
objRS.Open()
Dim arrayRS
arrayRS = objRS.GetRows()
objRS.Close
Set objRS = Nothing
' Load into array
Dim DispArray(20), i, iRow, iCol, tmpString, BlankNow, imgName, fileName
iRow = 0
BlankNow = False
For i = 0 To 20 Step 1
If BlankNow = True Then
tmpString = "
"
Else
fileName = Server.MapPath("images/category_images/" & arrayRS(0,iRow) & ".jpg")
If IsFileExists(fileName) = True Then
imgName = arrayRS(0,iRow)
Else
imgName = "blank"
End If
tmpString = "
"
End If
DispArray(i) = tmpString
If Not iRow = UBound(arrayRS, 2) Then
iRow = iRow + 1
Else
BlankNow = True
End If
Next
' ======================================================
%>