I am trying to build a small app that shows a Course Title from the
database, then displays a dropdown full of categories for the user to choose
one...
I thought a loop would be the best way to accomplish this, but since the
dropdown is dynamic, I am having problems. Can someone help me out here?
Here is my code,
For i = 1 to Num
Response.Write( "<table width='100%' border='0' cellspacing='0'
cellpadding='0' ><tr><td
width='52%'><%= (rsTitles.Field s.Item("Title") .Value)%></td><td
width='48%'><se lect name='select'>< option value=''>-- Select a
Category --</option><%While (NOT rsTitleCat.EOF) %><option
value='<%=(rsTi tleCat.Fields.I tem("CatID").Va lue)%>'><%=(rsT itleCat.Fields. Item("Category" ).Value)%></option><%rsTitl eCat.MoveNext()
Wend If (rsTitleCat.Cur sorType > 0) Then rsTitleCat.Move First Else
rsTitleCat.Requ ery End
If%></select></td></tr><tr><td>&nbs p;</td><td> </td></tr></table>")
Next
Thanks,
Drew 8 1685
Here is some more info... The error I am getting is,
Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/swvtc/DB/Emp/EmpTraining/TitleCategory.a sp, line 221, column 126
Line 221 being,
Response.Write( "<table width='100%' border='0' cellspacing='0'
cellpadding='0' ><tr><td
width='52%'><%= (rsTitles.Field s.Item("Title") .Value)%></td><td
width='48%'><se lect name='select'>< option value=''>-- Select a
Category --</option><%While (NOT rsTitleCat.EOF) %><option
value='<%=(rsTi tleCat.Fields.I tem("CatID").Va lue)%>'><%=(rsT itleCat.Fields. Item("Category" ).Value)%></option><%rsTitl eCat.MoveNext()
Wend If (rsTitleCat.Cur sorType > 0) Then rsTitleCat.Move First Else
rsTitleCat.Requ ery End
If></select></td></tr><tr><td>&nbs p;</td><td> </td></tr></table>")
Column 126 being around,
=(rsTitles.Fiel ds.Item("Title" ).Value)%
Anyone know what is going on?
Thanks,
Drew
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl... I am trying to build a small app that shows a Course Title from the database, then displays a dropdown full of categories for the user to choose one...
I thought a loop would be the best way to accomplish this, but since the dropdown is dynamic, I am having problems. Can someone help me out here?
Here is my code,
For i = 1 to Num Response.Write( "<table width='100%' border='0' cellspacing='0' cellpadding='0' ><tr><td width='52%'><%= (rsTitles.Field s.Item("Title") .Value)%></td><td width='48%'><se lect name='select'>< option value=''>-- Select a Category --</option><%While (NOT rsTitleCat.EOF) %><option value='<%=(rsTi tleCat.Fields.I tem("CatID").Va lue)%>'><%=(rsT itleCat.Fields. Item("Category" ).Value)%></option><%rsTitl eCat.MoveNext() Wend If (rsTitleCat.Cur sorType > 0) Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If%></select></td></tr><tr><td>&nbs p;</td><td> </td></tr></table>") Next
Thanks, Drew
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl... I am trying to build a small app that shows a Course Title from the database, then displays a dropdown full of categories for the user to
choose one...
I thought a loop would be the best way to accomplish this, but since the dropdown is dynamic, I am having problems. Can someone help me out here?
Here is my code,
For i = 1 to Num Response.Write( "<table width='100%' border='0' cellspacing='0' cellpadding='0' ><tr><td width='52%'><%= (rsTitles.Field s.Item("Title") .Value)%></td><td width='48%'><se lect name='select'>< option value=''>-- Select a Category --</option><%While (NOT rsTitleCat.EOF) %><option
value='<%=(rsTi tleCat.Fields.I tem("CatID").Va lue)%>'><%=(rsT itleCat.Fields. I
tem("Category") .Value)%></option><%rsTitl eCat.MoveNext() Wend If (rsTitleCat.Cur sorType > 0) Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If%></select></td></tr><tr><td>&nbs p;</td><td> </td></tr></table>") Next
Thanks, Drew
Will this help? Watch for word-wrap.
<%
Dim s
s = ""
For i = 1 to Num
s = s & "<table width='100%' border='0' cellspacing='0'
cellpadding='0' >" & vbCrLf
s = s & "<tr>" & vbCrLf
s = s & " <td width='52%'>" & rsTitles("Title ") & "</td>" & vbCrLf
s = s & " <td width='48%'>" & vbCrLf
s = s & " <select name='select'>" & vbCrLf
s = s & " <option value=''>-- Select a Category --</option>"
Do Until rsTitleCat.EOF
s = s & " <option value='" & rsTitleCat("Cat ID") & "'>"
s = s & rsTitleCat("Cat egory") & "</option>" & vbCrLf
rsTitleCat.Move Next
Loop
If rsTitleCat.Curs orType > 0 Then
rsTitleCat.Move First
Else
rsTitleCat.Requ ery
End If
s = s & " </select>" & vbCrLf
s = s & " </td>" & vbCrLf
s = s & "</tr>" & vbCrLf
s = s & "<tr>" & vbCrLf
s = s & " <td colspan='2'>&nb sp;</td>" & vbCrLf
s = s & "</tr>" & vbCrLf
s = s & "</table>"
s = s & "<br>"
Next
Response.Write( s)
%>
That got me on the right track... I see what you have done there!
Thanks a bunch!
Drew
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:gu******** ************@co mcast.com... "Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> wrote in message news:eS******** ******@TK2MSFTN GP10.phx.gbl... I am trying to build a small app that shows a Course Title from the database, then displays a dropdown full of categories for the user to choose one...
I thought a loop would be the best way to accomplish this, but since the dropdown is dynamic, I am having problems. Can someone help me out here?
Here is my code,
For i = 1 to Num Response.Write( "<table width='100%' border='0' cellspacing='0' cellpadding='0' ><tr><td width='52%'><%= (rsTitles.Field s.Item("Title") .Value)%></td><td width='48%'><se lect name='select'>< option value=''>-- Select a Category --</option><%While (NOT rsTitleCat.EOF) %><option value='<%=(rsTi tleCat.Fields.I tem("CatID").Va lue)%>'><%=(rsT itleCat.Fields. I tem("Category") .Value)%></option><%rsTitl eCat.MoveNext() Wend If (rsTitleCat.Cur sorType > 0) Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If%></select></td></tr><tr><td>&nbs p;</td><td> </td></tr></table>") Next
Thanks, Drew
Will this help? Watch for word-wrap.
<% Dim s s = "" For i = 1 to Num s = s & "<table width='100%' border='0' cellspacing='0' cellpadding='0' >" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td width='52%'>" & rsTitles("Title ") & "</td>" & vbCrLf s = s & " <td width='48%'>" & vbCrLf s = s & " <select name='select'>" & vbCrLf s = s & " <option value=''>-- Select a Category --</option>" Do Until rsTitleCat.EOF s = s & " <option value='" & rsTitleCat("Cat ID") & "'>" s = s & rsTitleCat("Cat egory") & "</option>" & vbCrLf rsTitleCat.Move Next Loop If rsTitleCat.Curs orType > 0 Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If s = s & " </select>" & vbCrLf s = s & " </td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td colspan='2'>&nb sp;</td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "</table>" s = s & "<br>" Next Response.Write( s) %>
Drew,
Better yet, convert this to using a GetRows array. There is no reason to do
all the requerying etc. Recordset loops are very inefficient. See www.aspfaq.com for an example (search using the keywords: recordset
iteration ).
Bob Barrows
McKirahan wrote: <% Dim s s = "" For i = 1 to Num s = s & "<table width='100%' border='0' cellspacing='0' cellpadding='0' >" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td width='52%'>" & rsTitles("Title ") & "</td>" & vbCrLf s = s & " <td width='48%'>" & vbCrLf s = s & " <select name='select'>" & vbCrLf s = s & " <option value=''>-- Select a Category --</option>" Do Until rsTitleCat.EOF s = s & " <option value='" & rsTitleCat("Cat ID") & "'>" s = s & rsTitleCat("Cat egory") & "</option>" & vbCrLf rsTitleCat.Move Next Loop If rsTitleCat.Curs orType > 0 Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If s = s & " </select>" & vbCrLf s = s & " </td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td colspan='2'>&nb sp;</td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "</table>" s = s & "<br>" Next Response.Write( s) %>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
It should be alright... this app is going to be used for this morning
only... just to get some Titles categorized... nothing else.
Thanks for your reply and I understand what you are saying, I just needed to
throw something together really quickly to save a little time.
Thanks,
Drew
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:O0******** ******@TK2MSFTN GP10.phx.gbl... Drew, Better yet, convert this to using a GetRows array. There is no reason to do all the requerying etc. Recordset loops are very inefficient. See www.aspfaq.com for an example (search using the keywords: recordset iteration ).
Bob Barrows
McKirahan wrote: <% Dim s s = "" For i = 1 to Num s = s & "<table width='100%' border='0' cellspacing='0' cellpadding='0' >" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td width='52%'>" & rsTitles("Title ") & "</td>" & vbCrLf s = s & " <td width='48%'>" & vbCrLf s = s & " <select name='select'>" & vbCrLf s = s & " <option value=''>-- Select a Category --</option>" Do Until rsTitleCat.EOF s = s & " <option value='" & rsTitleCat("Cat ID") & "'>" s = s & rsTitleCat("Cat egory") & "</option>" & vbCrLf rsTitleCat.Move Next Loop If rsTitleCat.Curs orType > 0 Then rsTitleCat.Move First Else rsTitleCat.Requ ery End If s = s & " </select>" & vbCrLf s = s & " </td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "<tr>" & vbCrLf s = s & " <td colspan='2'>&nb sp;</td>" & vbCrLf s = s & "</tr>" & vbCrLf s = s & "</table>" s = s & "<br>" Next Response.Write( s) %>
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Bob,
With all due respect, I understand your point about recordsets...bu t I dont
like arrays - it makes the code almost unreadable and it becomes a bitch to
sort out if you ever add/delete a column in the middle of select statement.
Here's the technique that I use:
set ix = Server.CreateOb ject("MSXML2.Do mDocument")
rs.save ix,1
rs.close
set rs = nothing
set nodeList = ix.selectNodes( "//z:row")
for each node in nodeList
response.write node.getAttribu te("columnName" ) ' columnName must be same
case as used in SELECT
next
That way I can release the recordset early and I can grab the field by name.
Brian
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:O0******** ******@TK2MSFTN GP10.phx.gbl... Drew, Better yet, convert this to using a GetRows array. There is no reason to do all the requerying etc. Recordset loops are very inefficient. See www.aspfaq.com for an example (search using the keywords: recordset iteration ).
Brian Staff wrote: Bob,
With all due respect, I understand your point about recordsets...bu t I dont like arrays - it makes the code almost unreadable and it
Maybe so (I've gotten used to it - it's not really that much harder), but
you can't beat it for pure performance. Only GetString is faster. The
bottleneck is looping through the recordset, which is a very complex
structure. Especially referring to the fields by name instead of by ordinal
position, which can slow things down quite a bit.
xpath queries are slow as well. I only use xml documents for passing data
across process boundaries (see http://www.davidpenton.com/testsite/tips/).
In the scenario you describe, you may as well disconnect your recordset,
close your connection and utilize your recordset object. IMO, you're not
really gaining anything by converting the recordset to xml and utilizing the
xml document in the same process. I've never compared the performance, so
YMMV. becomes a bitch to sort out if you ever add/delete a column in the middle of select statement.
As for new columns, I'm not sure why you'd ever put a new one in the middle
(there is nothing forcing anyone to consume the data in the order in which
they appear in a select statement), but the use of constants can mitigate
the pain (although I use dynamic sql for this illustration, do not take this
as an endorsement of its use).
sSQL = "select colQ, colE, colJ FROM ... "
const colQ = 0
const colE = 1
const colJ = 2
....
arData = rs.GetRows
rs.Close: set rs=nothing
conn.close: set conn = nothing
for iRow = 0 to ubound(arData,2 )
response.write "colE contains " & arData(colE, iRow) & "; " & _
response.write "colQ contains " & arData(colQ, iRow) & ...
next
Then, when te statement changes to :
sSQL = "select colQ, colE,colB, colJ FROM ... "
All you need to do is revise the constants:
const colQ = 0
const colE = 1
const colB = 2
const colJ = 3
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob,
Thanks for the reply. Good points all.
I started using the rs->xml technique when I started to separate the data
retrieval layer from the business logic layer.
Brian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Newbie1000 |
last post by:
Hi all, I have a piece of code that I can't seem to get to work. It compiles OK, but crashes when run :confused:
Simplified the code is:
Matrix::Matrix(int size){ // Constructor definition object Matrix
Size = size;
values = new double;
for (int i=0; i<Size; i++){ values = 0.0;}
}
void function1(Matrix<double> *Data1){
|
by: John F. |
last post by:
Hi all,
I'm searching fulltime for days now, and I don't find the solution, so I'm
thinking this is more a bug :(
If i use following code in form&subforms:
|
by: Jeff Uchtman |
last post by:
I know I have done this but my mind is fried. I have a dynamic dropdown in
a form. I need to pull both the dynamic dropdown's ID and name listed in
the dropdown. Need a little help with grey matter tonight.
Thank
Jeff
|
by: NewYorker |
last post by:
Q1:
Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .
Q2:
Given an int...
|
by: hjc |
last post by:
I am trying to write a program that will give me the number of coins it takes to make up a particular amout. if I write 50 in the command prompt it will say 2 quarters. I have this much and need help with the while loop
class coin{
static int amount;
public static void main(String args){
amount = Integer.parseInt(args);
...
| |
by: nicolas |
last post by:
hello, i am new to programming... i was looking for some help if
anybody can help me here, i'd glady appreciate it.
i have to create a for structure where it asks the user to input a
certain integer.
after the user inputs that integer it tells you to input more values
but only the amount of the first integer you put in.
So if you put in...
|
by: stressedstudent |
last post by:
I dont know where I am going wrong so I dont know which part to post, this is what I have, can anyone help me figure out where I am going wrong? THanks for any and all help.
// into to c++
// This program should use a loop that lets the user enter a series of integers.
// The user should enter -99 to signal the end of the series.
// After...
|
by: Thekid |
last post by:
I need help writing a loop for this.
image = ImageGrab.grab((0,0,800,800))
box = (100,100,400,400)
im = image.crop(box)
im1 = im.save("screen.jpg")
# at this point I need to rotate the image 90 degrees and crop it again, but do this four times-
# so I'd like a loop here instead of this:
im2 = im1.rotate(90)
im3 = im2.crop(box)
|
by: raamay |
last post by:
I want to have a dynamic dropdown box whose entries would depend on the selection of an entry in the first dropdown box. BUT the second dropdown box should not reload, only the entries inside should get refreshed or reloaded.
i have a piece of code to create a dynamic dropdown box from w3schools.com but it has the problem of reloading the...
|
by: falconsx23 |
last post by:
I am making a game called Set, it is a card game: here is a brief description of the rules:
The game of Set is played with 81 cards, each of which has 4 properties (number, pattern,
color and shape). The number of objects is 1, 2, or 3. The 3 possible patterns are solid,
striped, and open. The 3 possible colors are red, green, and purple. The...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |