Ask a Question related to ASP Database, Design and Development.
-
PorkyJr #1
SQL Statement looping
Trying to pull a report from an access 2k database that grabs the top 5
records for each day in a range (inputed by user). Yes, I know that the
* character is not a good idea, but I put it here for brevity.
Here is my SQL Statement:
LTQry = "SELECT TOP 5 * FROM History " & _
"WHERE Calendar = '" & tmpDte & "'"
Here is my code:
Do until tmpDte > rEndDte
Set RsTstOtpt = OBJdbConn.Execute(LTQry)
Do While Not RsTstOtpt.EOF
%>
<table>
<tr>
<td>
<%=RsTstOtpt("Event") %>
</td>
<td>
<%=RsTstOtpt("CustName") %>
</td>
<td>
<%=RsTstOtpt("Calendar") %>
</td>
<td>
<%=RsTstOtpt("History") %>
</td>
</tr>
</table>
<%
RsTstOtpt.MoveNext
Loop
RsTstOtpt.Close
Set RsTstOtpt = Nothing
tmpDte = DateAdd("d",1,tmpDte)
Loop
Here is the error message:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
(in line where the SQL statement is executed)
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
PorkyJr Guest
-
Looping
For some reason the dept names are randomly out putting twice on the outer loop. Does anyone know why this might be happening. Code: <CFQUERY... -
Looping .....Help!
HI i want to publish a swf file that only loops 3 times and it has to be published version 5. Anyone have a sneaky piece of code for lopping a fixed... -
XML and looping
Hey guys, I have a XML file as follows: <book> <Name>I Have a Dream</Name> <Price>3.00</Price> <Description>This is a great... -
Looping SWF
Oh yeah, I should mention that I am on Dir7! :) -
Looping or what?
The code below is suppose to replace some images and links but when I run it the page just seems to hang and eventually times out. Am I Looping... -
Ray at #2
Re: SQL Statement looping
Dates are delimited with # instead of ' in Access.
Ray at work
"PorkyJr" <nospam@nospam.net> wrote in message
news:%23RGHda%23zDHA.2328@TK2MSFTNGP10.phx.gbl...>
>
> Trying to pull a report from an access 2k database
>
> Here is my SQL Statement:
>
> LTQry = "SELECT TOP 5 * FROM History " & _
> "WHERE Calendar = '" & tmpDte & "'"
>
>
> Here is the error message:
> Microsoft JET Database Engine (0x80040E07)
> Data type mismatch in criteria expression.
Ray at Guest
-
Jeff Cochran #3
Re: SQL Statement looping
On Wed, 31 Dec 2003 13:39:46 -0800, PorkyJr <nospam@nospam.net> wrote:
First, do a Response.Write LTQry and make sure you're getting the>Trying to pull a report from an access 2k database that grabs the top 5
>records for each day in a range (inputed by user). Yes, I know that the
>* character is not a good idea, but I put it here for brevity.
>
>Here is my SQL Statement:
>
>LTQry = "SELECT TOP 5 * FROM History " & _
> "WHERE Calendar = '" & tmpDte & "'"
>
>Here is my code:
>
>Do until tmpDte > rEndDte
>Set RsTstOtpt = OBJdbConn.Execute(LTQry)
>Do While Not RsTstOtpt.EOF
>%>
><table>
><tr>
><td>
><%=RsTstOtpt("Event") %>
></td>
><td>
><%=RsTstOtpt("CustName") %>
></td>
><td>
><%=RsTstOtpt("Calendar") %>
></td>
><td>
><%=RsTstOtpt("History") %>
></td>
></tr>
></table>
><%
>RsTstOtpt.MoveNext
>Loop
>RsTstOtpt.Close
>Set RsTstOtpt = Nothing
>tmpDte = DateAdd("d",1,tmpDte)
>Loop
>
>Here is the error message:
>Microsoft JET Database Engine (0x80040E07)
>Data type mismatch in criteria expression.
>(in line where the SQL statement is executed)
query as you expected. Best guess is you have a date type versus
string type issue in your tmpDte. What type does your database use?
Jeff
Jeff Cochran Guest
-
PorkyJr #4
Re: SQL Statement looping
Did a response.write LTQry and it is looping as expected; however it is
not inserting the value of variable tmpDte. It doesn't matter if I use
the ' or # or ().
Thoughts?
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
PorkyJr Guest
-
Ray at #5
Re: SQL Statement looping
Can you post your Response.Write of LTQry?
Ray at work
"PorkyJr" <nospam@nospam.net> wrote in message
news:O8MMqaU0DHA.2156@TK2MSFTNGP12.phx.gbl...>
> Did a response.write LTQry and it is looping as expected; however it is
> not inserting the value of variable tmpDte. It doesn't matter if I use
> the ' or # or ().
>
> Thoughts?
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Ray at Guest
-
PorkyJr #6
Re: SQL Statement looping
Sorry, figured it out. Just had my SQL statement in the wrong place in
the code. Works like a champ when I put the SQL statement inside the
loop.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
PorkyJr Guest



Reply With Quote

