|
 |
asp_databases thread: SV: RE: Problems with MoveNext..
Message #1 by "SD-Studios" <info@s...> on Sun, 18 Mar 2001 18:35:46 +0100
|
|
Take a look at the second IF-statement lower down in the code. Thats the
real problem...
--
Martin Johansson
CEO & Project Supervisor,
Sola Data
http://www.sd-gaming.com
http://www.sd-studios.com
-----Ursprungligt meddelande-----
Från: Imar Spaanjaars [mailto:Imar@S...]
Skickat: den 18 mars 2001 18:30
Till: ASP Databases
Ämne: [asp_databases] RE: Problems with MoveNext..
What's wrong with that logic?? I think this makes perfect sense:
If Request.QueryString("letter") = "" Then
strLetter = "A"
Else
strLetter = Request.QueryString("letter")
End If
What he does here is get a value from the QueryString. If that doesn't
contain a value, set the value to "A". IMHO, this is a perfect, sane
statement. This will ensure that even the first time a user hits the page,
the correct query is executed.......
Imar
At 05:04 PM 3/18/2001 +0100, you wrote:
>Hi!
>
>Well, take a look at your logic in your IF statement. I also recommend that
>you declare your variables properly before you put them "to work"
>Like this:
>Dim strLetter
>strLetter= Request.QueryString("letter")
>
>And then later on in the code (and this is where your problems are. I
>suggest you think it over... )
>
>If strLetter = "" Then
>strLetter = "A"
>Else
>some code that you want to process when the letter is NOT A
>End If
>
>
>Just a quick response...have't had time to think it over, but I hope it
will
>give some idea.
>
>Hakan
>
>-----Original Message-----
>From: SD-Studios [mailto:info@s...]
>Sent: den 18 mars 2001 14:59
>To: ASP Databases
>Subject: [asp_databases] Problems with MoveNext..
>
>
>What ive tried to do is to put each record in a table using tr to get them
>on each row. But, if i havent got even digits of records. As you can see in
>the code printed lower ive tried to made an IF-string to make it stop
>looking for records if there is no. Heres the code:
>
><%
>Set objCon = Server.CreateObject("ADODB.Connection")
>Set objRS = Server.CreateObject("ADODB.Recordset")
>
>If Request.QueryString("letter") = "" Then
>strLetter = "A"
>Else
>strLetter = Request.QueryString("letter")
>End If
>objCon.Open "DSN=sd;UID=;PWD="
>SQL = "SELECT * FROM fusk WHERE LEFT(spelnamn, 1) = '" & strLetter & "' AND
>plattform = 'PC' ORDER BY spelnamn DESC"
>objRS.Open SQL, objCon, adOpenForwardOnly, adLockReadOnly
>%>
><p><font face="Verdana"
>size="3"><b>SPELFUSK/PC/<%=Request.QueryString("letter")%></b><form
>name="piss" method="get" action="pcspelfusk.asp">Välj
> bokstav här <select name="letter" size="1" style="font-family: Verdana,
>Arial, Helvetica, sans-serif; font-size: 12pt"
>onChange="forms['piss'].submit();">
> <option selected>#</option>
> <option value="A">A</option>
> <option value="B">B</option>
> <option value="C">C</option>
> <option value="D">D</option>
> <option value="E">E</option>
> <option value="F">F</option>
> <option value="G">G</option>
> <option value="H">H</option>
> <option value="I">I</option>
> <option value="J">J</option>
> <option value="K">K</option>
> <option value="L">L</option>
> <option value="M">M</option>
> <option value="N">N</option>
> <option value="O">O</option>
> <option value="P">P</option>
> <option value="Q">Q</option>
> <option value="R">R</option>
> <option value="S">S</option>
> <option value="T">T</option>
> <option value="U">U</option>
> <option value="V">V</option>
> <option value="W">W</option>
> <option value="X">X</option>
> <option value="Y">Y</option>
> <option value="Z">Z</option>
> <option value="Å">Å</option>
> <option value="Ä">Ä</option>
> <option value="Ö">Ö</option>
> </select></form></font>
><div align="left">
> <table border="0" width="452" cellpadding="0">
> <tr>
> <td width="177" height="9" valign="middle">
> <p class="text"><font size="2">Spelets namn</font>
> </td>
> <td width="90" height="9" valign="middle">
> <p class="text"><font size="2">Plattform</font>
> </td>
> <td width="173" height="9" valign="middle">
> <p class="text"><font size="2">Datum inlagt</font>
> </td>
> </tr>
><%
>Do While Not objRS.EOF
>%>
> <tr>
> <td width="177" height="1" valign="top" bgcolor="#E8E8E8"
>class="textlink"><form name="<%=objRS("spelnamn")%>" method="post"
>action="displayfusk.asp" onSubmit="processForm(this); return false;"><input
>type="hidden" name="folder" value="SPELFUSK/PC/A"><input type="hidden"
>name="fusk" value="<%=objRS("fusk")%>"><input type="hidden" name="datum"
>value="<%=objRS("datum")%>"><input type="hidden" name="plattform"
>value="<%=objRS("plattform")%>"><input type="hidden" name="spelnamn"
>value="<%=objRS("spelnamn")%>"><a href
>onClick="forms['<%=objRS("spelnamn")%>'].submit();"><font
>size="1"><%=objRS("spelnamn")%></font></a></form></td>
> <td width="90" height="1" valign="top" bgcolor="#E8E8E8"
>class="text"><font size="1"><%=objRS("plattform")%></font></td>
> <td width="173" height="1" valign="top" bgcolor="#E8E8E8"
>class="text"><font size="1"><%=objRS("datum")%></font></td>
> </tr>
><%
>If objRS.EOF Then
>Response.Write " "
>Else
>objRS.MoveNext
>%>
> <tr>
> <td width="177" height="1" valign="top" class="textlink"><form
>name="<%=objRS("spelnamn")%>" method="post" action="displayfusk.asp"
>onSubmit="processForm(this); return false;">
> <input type="hidden" name="folder" value="SPELFUSK/PC/A"><input
>type="hidden" name="fusk" value="<%=objRS("fusk")%>"><input type="hidden"
>name="spelnamn" value="<%=objRS("spelnamn")%>"><input type="hidden"
>name="datum" value="<%=objRS("datum")%>"><input type="hidden"
>name="plattform" value="<%=objRS("plattform")%>"><a href
>onClick="forms['<%=objRS("spelnamn")%>'].submit();"><font
>size="1"><%=objRS("spelnamn")%></font></a></form></td>
> <td width="90" height="1" valign="top" class="text"><font
>size="1"><%=objRS("plattform")%></font></td>
> <td width="173" height="1" valign="top" class="text"><font
>size="1"><%=objRS("datum")%></font></td>
> </tr>
><%
>End If
>objRS.MoveNext
>Loop
>%>
>
><%
>objRS.Close
>objCon.Close
>%>
---
SoftArtisans helps developers build robust, scalable Web applications!
Excel Web reports, charts: http://www.softartisans.com/excelwriter.html
File uploads: http://www.softartisans.com/saf.html
Transactional file management: http://www.softartisans.com/saf1.html
Scalability: http://www.softartisans.com/saxsession.html
ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
Message #2 by Imar Spaanjaars <Imar@S...> on Sun, 18 Mar 2001 23:02:54 +0100
|
|
Yes, I replied to that in my previous message, didn't I ?? Just wondered
what Hakan thought was wrong with your coding logic for the strLetter
variable......
Imar
At 06:35 PM 3/18/2001 +0100, you wrote:
>Take a look at the second IF-statement lower down in the code. Thats the
>real problem...
>--
>Martin Johansson
>CEO & Project Supervisor,
>Sola Data
>http://www.sd-gaming.com
>http://www.sd-studios.com
Message #3 by "Daniel O'Dorisio" <dodorisio@h...> on Sun, 18 Mar 2001 17:12:50 -0500
|
|
you dont need the second if statement, you do loop statement will take care
of it all.
i think your problem is, you want to switch every other bgcolor. this can be
done with some code like this
Dim num
num = 0
Do While Not objrs.EOF
Response.Write "<tr bgcolor="""
if num mod 2 = 0 then
Response.Write "color1(hex)"
Else
Response.Write "color2(hex)"
End IF
Response.Write """>"
'write all your other stuff, data ect
num = num + 1
objRs.MoveNext
Loop
i think that will do the trick, if not. tell me. i kinda wrote this on the
fly.
Daniel
-----Original Message-----
From: SD-Studios [mailto:info@s...]
Sent: Sunday, March 18, 2001 12:36 PM
To: ASP Databases
Subject: [asp_databases] SV: RE: Problems with MoveNext..
Take a look at the second IF-statement lower down in the code. Thats the
real problem...
--
Martin Johansson
CEO & Project Supervisor,
Sola Data
http://www.sd-gaming.com
http://www.sd-studios.com
-----Ursprungligt meddelande-----
Från: Imar Spaanjaars [mailto:Imar@S...]
Skickat: den 18 mars 2001 18:30
Till: ASP Databases
Ämne: [asp_databases] RE: Problems with MoveNext..
What's wrong with that logic?? I think this makes perfect sense:
If Request.QueryString("letter") = "" Then
strLetter = "A"
Else
strLetter = Request.QueryString("letter")
End If
What he does here is get a value from the QueryString. If that doesn't
contain a value, set the value to "A". IMHO, this is a perfect, sane
statement. This will ensure that even the first time a user hits the page,
the correct query is executed.......
Imar
At 05:04 PM 3/18/2001 +0100, you wrote:
>Hi!
>
>Well, take a look at your logic in your IF statement. I also recommend that
>you declare your variables properly before you put them "to work"
>Like this:
>Dim strLetter
>strLetter= Request.QueryString("letter")
>
>And then later on in the code (and this is where your problems are. I
>suggest you think it over... )
>
>If strLetter = "" Then
>strLetter = "A"
>Else
>some code that you want to process when the letter is NOT A
>End If
>
>
>Just a quick response...have't had time to think it over, but I hope it
will
>give some idea.
>
>Hakan
>
>-----Original Message-----
>From: SD-Studios [mailto:info@s...]
>Sent: den 18 mars 2001 14:59
>To: ASP Databases
>Subject: [asp_databases] Problems with MoveNext..
>
>
>What ive tried to do is to put each record in a table using tr to get them
>on each row. But, if i havent got even digits of records. As you can see in
>the code printed lower ive tried to made an IF-string to make it stop
>looking for records if there is no. Heres the code:
>
><%
>Set objCon = Server.CreateObject("ADODB.Connection")
>Set objRS = Server.CreateObject("ADODB.Recordset")
>
>If Request.QueryString("letter") = "" Then
>strLetter = "A"
>Else
>strLetter = Request.QueryString("letter")
>End If
>objCon.Open "DSN=sd;UID=;PWD="
>SQL = "SELECT * FROM fusk WHERE LEFT(spelnamn, 1) = '" & strLetter & "' AND
>plattform = 'PC' ORDER BY spelnamn DESC"
>objRS.Open SQL, objCon, adOpenForwardOnly, adLockReadOnly
>%>
><p><font face="Verdana"
>size="3"><b>SPELFUSK/PC/<%=Request.QueryString("letter")%></b><form
>name="piss" method="get" action="pcspelfusk.asp">Välj
> bokstav här <select name="letter" size="1" style="font-family: Verdana,
>Arial, Helvetica, sans-serif; font-size: 12pt"
>onChange="forms['piss'].submit();">
> <option selected>#</option>
> <option value="A">A</option>
> <option value="B">B</option>
> <option value="C">C</option>
> <option value="D">D</option>
> <option value="E">E</option>
> <option value="F">F</option>
> <option value="G">G</option>
> <option value="H">H</option>
> <option value="I">I</option>
> <option value="J">J</option>
> <option value="K">K</option>
> <option value="L">L</option>
> <option value="M">M</option>
> <option value="N">N</option>
> <option value="O">O</option>
> <option value="P">P</option>
> <option value="Q">Q</option>
> <option value="R">R</option>
> <option value="S">S</option>
> <option value="T">T</option>
> <option value="U">U</option>
> <option value="V">V</option>
> <option value="W">W</option>
> <option value="X">X</option>
> <option value="Y">Y</option>
> <option value="Z">Z</option>
> <option value="Å">Å</option>
> <option value="Ä">Ä</option>
> <option value="Ö">Ö</option>
> </select></form></font>
><div align="left">
> <table border="0" width="452" cellpadding="0">
> <tr>
> <td width="177" height="9" valign="middle">
> <p class="text"><font size="2">Spelets namn</font>
> </td>
> <td width="90" height="9" valign="middle">
> <p class="text"><font size="2">Plattform</font>
> </td>
> <td width="173" height="9" valign="middle">
> <p class="text"><font size="2">Datum inlagt</font>
> </td>
> </tr>
><%
>Do While Not objRS.EOF
>%>
> <tr>
> <td width="177" height="1" valign="top" bgcolor="#E8E8E8"
>class="textlink"><form name="<%=objRS("spelnamn")%>" method="post"
>action="displayfusk.asp" onSubmit="processForm(this); return false;"><input
>type="hidden" name="folder" value="SPELFUSK/PC/A"><input type="hidden"
>name="fusk" value="<%=objRS("fusk")%>"><input type="hidden" name="datum"
>value="<%=objRS("datum")%>"><input type="hidden" name="plattform"
>value="<%=objRS("plattform")%>"><input type="hidden" name="spelnamn"
>value="<%=objRS("spelnamn")%>"><a href
>onClick="forms['<%=objRS("spelnamn")%>'].submit();"><font
>size="1"><%=objRS("spelnamn")%></font></a></form></td>
> <td width="90" height="1" valign="top" bgcolor="#E8E8E8"
>class="text"><font size="1"><%=objRS("plattform")%></font></td>
> <td width="173" height="1" valign="top" bgcolor="#E8E8E8"
>class="text"><font size="1"><%=objRS("datum")%></font></td>
> </tr>
><%
>If objRS.EOF Then
>Response.Write " "
>Else
>objRS.MoveNext
>%>
> <tr>
> <td width="177" height="1" valign="top" class="textlink"><form
>name="<%=objRS("spelnamn")%>" method="post" action="displayfusk.asp"
>onSubmit="processForm(this); return false;">
> <input type="hidden" name="folder" value="SPELFUSK/PC/A"><input
>type="hidden" name="fusk" value="<%=objRS("fusk")%>"><input type="hidden"
>name="spelnamn" value="<%=objRS("spelnamn")%>"><input type="hidden"
>name="datum" value="<%=objRS("datum")%>"><input type="hidden"
>name="plattform" value="<%=objRS("plattform")%>"><a href
>onClick="forms['<%=objRS("spelnamn")%>'].submit();"><font
>size="1"><%=objRS("spelnamn")%></font></a></form></td>
> <td width="90" height="1" valign="top" class="text"><font
>size="1"><%=objRS("plattform")%></font></td>
> <td width="173" height="1" valign="top" class="text"><font
>size="1"><%=objRS("datum")%></font></td>
> </tr>
><%
>End If
>objRS.MoveNext
>Loop
>%>
>
><%
>objRS.Close
>objCon.Close
>%>
|
|
 |