Valter,
OK, go back to your previous code but remove the if statement that evluates the
recordcount. Run it and let me know how it goes.
Mark
valter piso <[EMAIL PROTECTED]> wrote:
The code I did attach to my previous email was running but the page wasnt
displaying anything (blank). I did try to copy and run your code and it returns
me an error:
Object doesn't support this property or method: 'ObjRS.Field'
Ciao
Valter
Mark E <[EMAIL PROTECTED]> wrote:
Valter,
What happens when you run the code?
The only thing that jumps out at me is the line that checks the recordcount. I
put this in to ensure that you get 2 records back. But you may want to remove
it and try it to see if you get different results.
Also, try to reduce the opening & closing asp tags. It makes it easier to read:
<%@ LANGUAGE ="VBSCRIPT" %>
<%
Dim ChartDB
Dim ChartDBPath
strChartDBPath = Server.MapPath("pippo.mdb")
set ChartDB = Server.CreateObject("ADODB.Connection")
ChartDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strChartDBPath &
";"
set ObjRS = Server.CreateObject("ADODB.RecordSet")
ObjRS.Open "select TOP 2 id_value, value from valori order by id_value desc",
ChartDB, 2, 3
Do While Not ObjRS.EOF
strValue1 = ObjRS.Field("value")
strValue2 = ObjRS.Field("value")
If strValue2 = strValue1 then
%>
<tr>
<td><img src="../magazine/uptrend.gif"></td>
</tr>
<%
end if
ObjRS.MoveNext
Loop
ObjRS.Close
set ObjRS = Nothing
ChartDB.Close
set ChartDB = Nothing
%>
Mark
valter piso <[EMAIL PROTECTED]> wrote:
Thank you so much for your help,
I did follow your advice but yet (sure its my fault) I couldnt get through it.
I attach my code lines (this is just a trial version) so that you will easily
find out where i do mistake.
Thank you again for your kindness.
Valter
<%@ LANGUAGE ="VBSCRIPT" %>
<%
Dim ChartDB
Dim ChartDBPath
strChartDBPath = Server.MapPath("pippo.mdb")
%>
<%
set ChartDB = Server.CreateObject("ADODB.Connection")
ChartDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strChartDBPath &
";"
%>
<%
set ObjRS = Server.CreateObject("ADODB.RecordSet")
ObjRS.Open "select TOP 2 id_value, value from valori order by id_value desc",
ChartDB, 2, 3
Do While Not ObjRS.EOF
%>
<%
If ObjRS.RecordCount = 2 then
strValue1 = ObjRS.Field("value")
strValue2 = ObjRS.Field("value")
%>
<%
If strValue2 = strValue1 then
%>
<tr>
<td><img src="../magazine/uptrend.gif"></td>
</tr>
<%
end if
%>
<%
end if
%>
<%
ObjRS.MoveNext
Loop
%>
<%
ObjRS.Close
set ObjRS = Nothing
%>
<%
ChartDB.Close
set ChartDB = Nothing
%>
Mark E <[EMAIL PROTECTED]> wrote:
This should get the last 2 records in your table:
select top 2 id_value, [date], value
from tblTest
order by id_value desc
The following assumes that you have the code to get your data and shows how you
can get the values and subract them in order to get your difference:
If ObjRS.RecordCount = 2 Then
'We have our 2 records. Get the value into var's
strID1 = ObjRS.Fields("id_value")
strDate1 = ObjRS.Fields("date")
strValue1 = ObjRS.Fields("value")
'Move to the second record.
strID2 = ObjRS.Fields("id_value")
strDate2 = ObjRS.Fields("date")
strValue2 = ObjRS.Fields("value")
'Destroy our recordset object.
set ObjRS = Nothing
'Get the diff between our 2 values.
Dim strDifference
strDifference = strValue2 - strValue1
'Display all your data!
End If
Mark
valter piso <[EMAIL PROTECTED]> wrote:
The Access db table (QUOTATIONS) has the following fields:
id_value date value
1 12/04 4.85
2 13/04 4.87
3 14/04 4.83
id_value is a "Counter" field
date is a "text" field
value is a "Numeric" field
The page layout should look like this:
previous value last value variation
4.87 4.83 (last value - previous
value) -0.04
So I need to know how to get the last 2 records of my table.
Actually I do not have a code to show coz all is based on this....
Thank you for your help,
Valter
Mark E <[EMAIL PROTECTED]> wrote:
Posting your code and database layout would help
tremendously.
Mark
--- Valter <[EMAIL PROTECTED]> wrote:
>
> Ok..lets explain better..
> Everyday I receive currency value which I store in a
> db and I show
> always the last one on my web page.
> What I need to do is to calculate the daily trend
> based on the absolute
> variation (last value - previous value) and show it
> on my page using
> gif symbols (arrow up, arrow down, stable). I do
> know how to create the
> if statements, I know how to get the last value but
> I do not know how
> to get the last value -1 (previous value).
> Hope this would be a bit clearer and can help you to
> understand better.
> Thank you
> Valter
>
>
>
>
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/