|
I have a database containing ALL the links of my webpage. I want to create a menu out of this. That menu is working but there are some links that doesn't has to be in the menu. i can check this thru a special field in the database. if it is empty, then that link doesn't has to be in the menu, but i dont know how to filter. Below is the code for the database. i left out a lot of code for creating the menu. see the red comment in the code below to see the things that do and don't work. If possible, i need a quick answer.
Greetings Chris
---- menu.asp ----
Dim DataConn, cmdDC, rsDC Dim Item Dim iFieldCount, iLoopVar Dim strLTorGT, iCriteria, strSortBy, strOrder Dim sRequestIP
' Get request information sRequestIP=Request.ServerVariables("REMOTE_ADDR")
' Set general variables FoundRecordCount=0 'sDataSource = "d:\desktop\Webpagina gravenrode\links.mdb" sDataSource = "c:\inetpub\wwwroot\links.mdb" ' Local Path to Database BackgroundColor="FFFFFF" RecordFound=0
' Create and establish data connection Set DataConn = Server.CreateObject("ADODB.Connection") DataConn.ConnectionTimeout = 15 DataConn.CommandTimeout = 30
'Access connection code DataConn.Open "DBQ=" & sDataSource & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20;", "username", "password"
' Create and link command object to data connection then set attributes and SQL query Set cmdDC = Server.CreateObject("ADODB.Command") cmdDC.ActiveConnection = DataConn cmdDC.CommandText = "SELECT * FROM Links" cmdDC.CommandType = 1
' Create recordset Set rsDC = Server.CreateObject("ADODB.Recordset") ' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1) rsDC.Open cmdDC, , 1, 1
' Hier komt nu de loop om het menu in te lezen txtStream.WriteLine "//begin of database lookup" rsDC.MoveFirst Do while not rsDC.EOF 'this doesn't work why?? If rsDC.fields("Menu_Location") = "" then rsDC.Movenext Else 'this does work txtStream.WriteLine "Menu" & rsDC.fields("Menu_Location") & "=new Array(""" & rsDC.fields("LinkDescription") & """,""" & rsDC.fields("LinkUrl")& ""","",0,20,110);" End If rsDC.Movenext loop txtStream.WriteLine "//end of database lookup" ' Dit is het einde van de loop om het menu in te lezen
' Close Data Access Objects rsDC.Close Set rsDC = Nothing Set cmdDC = Nothing DataConn.Close Set DataConn = Nothing
---- end menu.asp ----
------------- Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here
|