Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 30th, 2004, 10:48 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default why blank page?

I found one by Google. But why is this returning blank page?


Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' FileName="default_oledb.htm"
' Type="ADO" 
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""

Dim MM_connPlayGround_STRING
Dim strSource : strSource = Server.MapPath("kjv.mdb")

MM_connPlayGround_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strSource & ";"

%>

<%
Dim rsMain
Dim rsMain_numRows

Set rsMain = Server.CreateObject("ADODB.Recordset")
rsMain.ActiveConnection = MM_connPlayGround_STRING
rsMain.Source = "SELECT *  FROM bible  ORDER BY book"
rsMain.CursorType = 0
rsMain.CursorLocation = 2
rsMain.LockType = 1
rsMain.Open()

rsMain_numRows = 0
%>
<%
Dim rsSub
Dim rsSub_numRows

Set rsSub = Server.CreateObject("ADODB.Recordset")
rsSub.ActiveConnection = MM_connPlayGround_STRING
rsSub.Source = "SELECT *  FROM bible  ORDER BY chapter"
rsSub.CursorType = 0
rsSub.CursorLocation = 2
rsSub.LockType = 1
rsSub.Open()

rsSub_numRows = 0
%>

<html>
<head>
<title>Client Side Dependent List Menu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #FBFAF7;
margin: 5px;
}

body, td, p {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-style: normal;
color: #2F2F2F;
}

a:link {
color: #00497D;
text-decoration: underline;
}

a:visited {
color: #00497D;
text-decoration: underline;
}

a:hover {
color: #607E54;
text-decoration: none;
}

a:active {
color: #FFFFFF;
}

h1, h2, h3, h4, h5, h6, th {
font-family: Arial, Helvetica, sans-serif;
}

h1 {
font-size: 1.75em;
color: #607E54;
}

h2 {
font-size: 1.5em;
color: #00497D;

}

h3 {
font-size: 1.25em;
color: #607E54;
}

h4 {
font-size: 1.25em;
color: #00497D;
margin-bottom: 0px;
}

h5 {
font-size: 1.25em;
color: #607E54;
}


th {
font-size: 12px;
color: #607E54;
margin: 0px;
font-weight: bold;
}

select.select-type1 {
background-color: #E9E7D4;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;
font-size: 10px;
}

-->
</style>


<script language="JavaScript">
<!--

var arrDynaList = new Array();
var arrDL1 = new Array();

arrDL1[1] = "select1";        // Name of parent list box
arrDL1[2] = "form1";        // Name of form containing parent list box
arrDL1[3] = "select2";        // Name of child list box
arrDL1[4] = "form1";        // Name of form containing child list box
arrDL1[5] = arrDynaList;    // No need to do anything here
  
<%
Dim txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS

txtDynaListRelation = "SubCat_MainCatID"     ' Name of recordset field relating to parent
txtDynaListLabel = "SubCat_Name"             ' Name of recordset field for child Item Label
txtDynaListValue = "SubCategoryID"             ' Name of recordset field for child Value
Set oDynaListRS = rsSub                        ' Name of child list box recordset
  
Dim varDynaList
varDynaList = -1

Dim varMaxWidth
varMaxWidth = "1"

Dim varCheckGroup
varCheckGroup = oDynaListRS.Fields.Item(txtDynaListRelation).Value  

Dim varCheckLength
varCheckLength = 0

Dim varMaxLength
varMaxLength = 0

While (NOT oDynaListRS.EOF)

 If (varCheckGroup <> oDynaListRS.Fields.Item(txtDynaListRelation).Value  ) Then
  If (varCheckLength > varMaxLength) Then
   varMaxLength = varCheckLength
  End If
  varCheckLength = 0
 End If
%>
 arrDynaList[<%=(varDynaList+1)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListRelation).Va  lue)%>"
 arrDynaList[<%=(varDynaList+2)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListLabel).Value  )%>"
 arrDynaList[<%=(varDynaList+3)%>] = "<%=(oDynaListRS.Fields.Item(txtDynaListValue).Value  )%>"
<%
 If (len(oDynaListRS.Fields.Item(txtDynaListLabel).Val  ue) > len(varMaxWidth)) Then
  varMaxWidth = oDynaListRS.Fields.Item(txtDynaListLabel).Value
 End If
 varCheckLength = varCheckLength + 1
 varDynaList = varDynaList + 3
 oDynaListRS.MoveNext()
Wend

If (varCheckLength > varMaxLength) Then
 varMaxLength = varCheckLength
End If
%>

//-->
</script>



<script language="JavaScript">
<!--
function setDynaList(arrDL){

 var oList1 = document.forms[arrDL[2]].elements[arrDL[1]];
 var oList2 = document.forms[arrDL[4]].elements[arrDL[3]];
 var arrList = arrDL[5];
 
 clearDynaList(oList2);
 
 if (oList1.selectedIndex == -1){
  oList1.selectedIndex = 0;
 }

 populateDynaList(oList2, oList1[oList1.selectedIndex].value, arrList);
 return true;
}
 
function clearDynaList(oList){

 for (var i = oList.options.length; i >= 0; i--){
  oList.options[i] = null;
 }
 
 oList.selectedIndex = -1;
}
 
/*This is a modified function from the original MM script. Mick White 
added the first line of oList so there would be an initial selection.
Needed this if there is only 1 child menu item, otherwise, the single
child menu item would be already hihghlighted and you can not select 
it. Also good for validation purposes so you can set the .js 
validation to not allow the first selection.
*/

function populateDynaList(oList, nIndex, aArray){
oList[oList.length]= new Option("Please Select");
 for (var i = 0; i < aArray.length; i= i + 3){
  if (aArray[i] == nIndex){
   oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);
  }
  //oList.size=oList.length //You need to comment out this line of the function if you use this mod
 }

//A quick mod here, I changed the ==0 to ==1 so that the length 
//takes into account the Please select option from above.
 if (oList.options.length == 1){
  oList.options[oList.options.length] = new Option(":: No SubCategories Available ::");
 }
 oList.selectedIndex = 0; 
}

//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" onLoad="setDynaList(arrDL1)">

<p>&nbsp;</p>
<form name="form1" method="post" action="">
    <table width="650" border="0" cellspacing="0" cellpadding="5" align="center">
        <tr> 
            <th valign="bottom" width="50%">Parent List Menu</th>
            <th width="50%">Child List Menu</th>
        </tr>
        <tr> 
            <td valign="top" width="50%">Making any selection here repopulates 
                the Child List Box on the right.</td>
            <td width="50%" valign="top"> <p>This set will say and highlight &quot;<span class="attention">Please
                            Select</span>&quot; whenever it is re-populated from the Parent 
                    List Box. It will now maintain it's original height of 10
                                lines and will not grow/shrink vertically based
                            on content.</p>
                <p>I <span class="row-selected">commented out</span> the last 
                    line in the function to make this work.</p></td>
        </tr>
        <tr> 
            <td align="center"> <select name="select1" size="10" onChange="setDynaList(arrDL1)" class="select-type1">
                    <%
While (NOT rsMain.EOF)
%>
                    <option value="<%=(rsMain.Fields.Item("MainCategoryID").Value)%>"><%=(rsMain.Fields.Item("MainCat_Name").Value)%></option>
                    <%
  rsMain.MoveNext()
Wend
If (rsMain.CursorType > 0) Then
  rsMain.MoveFirst
Else
  rsMain.Requery
End If
%>
                </select> </td>
            <td align="center"> <select name="select2" size="10" class="select-type1">
                </select> </td>
        </tr>
        <tr> 
            <td colspan="2"> <p>&nbsp;</p>
                <p>This is a slightly modifed version of the <a href="http://www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listbox.htm">technote
                        from Macromedia</a>.</p>
                <p>All of the asp/vbscript is the same; we modified the function 
                    described below to maintain the child list box's height and 
                    the initially selected item to say &quot;please select&quot; 
                    which helps in form validation so that the use must choose 
                    something other than the first item.</p>
                <p>&nbsp;</p>
             <h4>Here is the function to modify to:</h4>
                <ol>
                    <li> maintain the height of 10</li>
                    <li> initially selected item to say &quot;please select&quot;</li>
                </ol>
<pre>function populateDynaList(oList, nIndex, aArray){
oList[oList.length]= new Option("Please Select");
 for (var i = 0; i < aArray.length; i= i + 3){
  if (aArray[i] == nIndex){
   oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);
  }
  //oList.size=oList.length //You need to comment out this line of the function if you use this mod
 }

//A quick mod here, I changed the ==0 to ==1 so that the length takes into account the Please select option
//from above.
 if (oList.options.length == 1){
  oList.options[oList.options.length] = new Option(":: No SubCategories Available ::");
 }
 oList.selectedIndex = 0; 
}

</pre></td>
     </tr>
    </table>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<%
rsMain.Close()
Set rsMain = Nothing
%>
<%
rsSub.Close()
Set rsSub = Nothing
%>
Thanks
Reply With Quote
  #2 (permalink)  
Old December 31st, 2004, 12:18 AM
Friend of Wrox
 
Join Date: Sep 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu
Default

Hi,
    Can u tell what exactly you want?
Thnaks
Suresh

Reply With Quote
  #3 (permalink)  
Old December 31st, 2004, 12:25 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Yeah that would be better. With knowing what exactly is the problem you are trying to address it would be hard to go through and understand the logic ourself!

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
Reply With Quote
  #4 (permalink)  
Old December 31st, 2004, 05:32 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

what this code has is a parent child relationship if you know what i mean. But I have one table. One column for book_title (name of 66 books), one for chapter, one for verse, one for text_data. I was looking for a combo listbox for book_title, chapter, and verse and then by pressing "search" the iframe would open with the text_data. But I don't see anything so far.

Reply With Quote
  #5 (permalink)  
Old December 31st, 2004, 05:43 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

is there a way to avoid the parent child relationship?


Reply With Quote
  #6 (permalink)  
Old December 31st, 2004, 07:58 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

WHat I have is a column of recordTypes.

Reply With Quote
  #7 (permalink)  
Old December 31st, 2004, 09:30 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

Do you recommend any tutorial?


Learning of our true origins.

I feel sorry:

http://www.infowars.com/articles/wor...eknowledge.htm

Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank Struts page after submit simistef Struts 2 August 28th, 2007 12:46 AM
Blank Default Page ghrebek BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 8 December 5th, 2006 08:09 PM
Every other page blank in PDF jmurdock BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 6th, 2004 12:44 PM



All times are GMT -4. The time now is 11:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.