Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

help with this IF, Else, Else If and End If problem? ASP/VB

LEGEND ,
Nov 15, 2006 Nov 15, 2006
Hoping someone can help me with this. I have three database tables,
orderdetails, paidorders, ordercomplete and the following recordset:

<%
Dim rsOrderSearch
Dim rsOrderSearch_cmd
Dim rsOrderSearch_numRows

Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR itemdescription
LIKE ? ORDER BY orderdate DESC"
rsOrderSearch_cmd.Prepared = true
rsOrderSearch_cmd.Parameters.Append
rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
rsOrderSearch__MMColParam) ' adDouble
rsOrderSearch_cmd.Parameters.Append
rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
rsOrderSearch__MMColParam1) ' adDouble
rsOrderSearch_cmd.Parameters.Append
rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
rsOrderSearch__MMColParam2 + "%") ' adVarChar

Set rsOrderSearch = rsOrderSearch_cmd.Execute
rsOrderSearch_numRows = 0
%>

If the orderID appears in the ordercomplete table (thus COMPLETEORDER would
have a COUNT value of 1), I want to display "Completed".
If the orderID appears in the paidorders table (thus PAIDORDER would have a
COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
For everything else, I want to display "Open Job".

For some reason, the following doesn't display the "Awaiting
Pickup/Delivery" option, but seems to be displaying "Completed" correctly.
I've tried various combinations, but it looks correct to me! Is it?:

<%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
<span class="greentext">Completed</span>
<%Else%>
<%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
<span class="orangetext">Awaiting Pickup/Delivery</span>
<%Else%>
<span class="redtext">Open Job</span>
<%End If%>
<%End If%>

Also, the above code is in a table cell within a repeat region. If I move
this to a different table cell within the same repeat region, it doesn't
display at all! This seems more like a bug to be honest, but considering
the above code doesn't work, I'm wondering if that is the reason?

If anyone can help, I'd really appreciate it. Thanks.
Regards
Nath.






TOPICS
Server side applications
481
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2006 Nov 15, 2006
I think the problem has to do with your logic.

Can you give us some examples of the values for a record, specifically the
values for

- COMPLETEORDER
- PAIDORDER

Like:

- a paid order looks like this:
- a complete order looks like this:




"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:ejfc53$pgm$1@forums.macromedia.com...
> Hoping someone can help me with this. I have three database tables,
> orderdetails, paidorders, ordercomplete and the following recordset:
>
> <%
> Dim rsOrderSearch
> Dim rsOrderSearch_cmd
> Dim rsOrderSearch_numRows
>
> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR itemdescription
> LIKE ? ORDER BY orderdate DESC"
> rsOrderSearch_cmd.Prepared = true
> rsOrderSearch_cmd.Parameters.Append
> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
> rsOrderSearch__MMColParam) ' adDouble
> rsOrderSearch_cmd.Parameters.Append
> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
> rsOrderSearch__MMColParam1) ' adDouble
> rsOrderSearch_cmd.Parameters.Append
> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>
> Set rsOrderSearch = rsOrderSearch_cmd.Execute
> rsOrderSearch_numRows = 0
> %>
>
> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
> would have a COUNT value of 1), I want to display "Completed".
> If the orderID appears in the paidorders table (thus PAIDORDER would have
> a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
> For everything else, I want to display "Open Job".
>
> For some reason, the following doesn't display the "Awaiting
> Pickup/Delivery" option, but seems to be displaying "Completed" correctly.
> I've tried various combinations, but it looks correct to me! Is it?:
>
> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
> <span class="greentext">Completed</span>
> <%Else%>
> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
> <span class="orangetext">Awaiting Pickup/Delivery</span>
> <%Else%>
> <span class="redtext">Open Job</span>
> <%End If%>
> <%End If%>
>
> Also, the above code is in a table cell within a repeat region. If I move
> this to a different table cell within the same repeat region, it doesn't
> display at all! This seems more like a bug to be honest, but considering
> the above code doesn't work, I'm wondering if that is the reason?
>
> If anyone can help, I'd really appreciate it. Thanks.
> Regards
> Nath.
>
>
>
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2006 Nov 15, 2006
Hi,

I'm hoping there's nothing wrong with my logic, but I think I've spotted the
problem!

Within that recordset, there is a field called "deliverdetails". This is an
ntext field in my database.
Because this doesn't appear as the last field in the list of fields in the
statement it causes "weird" things to happen.
I removed the reference to this field, and it's all working!

Sometimes I really don't understand why it would cause other fields to fail,
or not function properly, but ntext fields are just not handled very well by
DW 8.0.2. Groan.

Thanks anyway Pizza.
Nath.

"PizzaGood" <PizzaGood@earthlink.com> wrote in message
news:ejfe3j$rp7$1@forums.macromedia.com...
>I think the problem has to do with your logic.
>
> Can you give us some examples of the values for a record, specifically the
> values for
>
> - COMPLETEORDER
> - PAIDORDER
>
> Like:
>
> - a paid order looks like this:
> - a complete order looks like this:
>
>
>
>
> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
> news:ejfc53$pgm$1@forums.macromedia.com...
>> Hoping someone can help me with this. I have three database tables,
>> orderdetails, paidorders, ordercomplete and the following recordset:
>>
>> <%
>> Dim rsOrderSearch
>> Dim rsOrderSearch_cmd
>> Dim rsOrderSearch_numRows
>>
>> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
>> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
>> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
>> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
>> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
>> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
>> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
>> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR
>> itemdescription LIKE ? ORDER BY orderdate DESC"
>> rsOrderSearch_cmd.Prepared = true
>> rsOrderSearch_cmd.Parameters.Append
>> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
>> rsOrderSearch__MMColParam) ' adDouble
>> rsOrderSearch_cmd.Parameters.Append
>> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
>> rsOrderSearch__MMColParam1) ' adDouble
>> rsOrderSearch_cmd.Parameters.Append
>> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
>> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>>
>> Set rsOrderSearch = rsOrderSearch_cmd.Execute
>> rsOrderSearch_numRows = 0
>> %>
>>
>> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
>> would have a COUNT value of 1), I want to display "Completed".
>> If the orderID appears in the paidorders table (thus PAIDORDER would have
>> a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
>> For everything else, I want to display "Open Job".
>>
>> For some reason, the following doesn't display the "Awaiting
>> Pickup/Delivery" option, but seems to be displaying "Completed"
>> correctly.
>> I've tried various combinations, but it looks correct to me! Is it?:
>>
>> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
>> <span class="greentext">Completed</span>
>> <%Else%>
>> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
>> <span class="orangetext">Awaiting Pickup/Delivery</span>
>> <%Else%>
>> <span class="redtext">Open Job</span>
>> <%End If%>
>> <%End If%>
>>
>> Also, the above code is in a table cell within a repeat region. If I
>> move this to a different table cell within the same repeat region, it
>> doesn't display at all! This seems more like a bug to be honest, but
>> considering the above code doesn't work, I'm wondering if that is the
>> reason?
>>
>> If anyone can help, I'd really appreciate it. Thanks.
>> Regards
>> Nath.
>>
>>
>>
>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2006 Nov 15, 2006
If it works I'm happy!

I ran into that same stupid problem before with a text field.


"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:ejfef7$sat$1@forums.macromedia.com...
> Hi,
>
> I'm hoping there's nothing wrong with my logic, but I think I've spotted
> the problem!
>
> Within that recordset, there is a field called "deliverdetails". This is
> an ntext field in my database.
> Because this doesn't appear as the last field in the list of fields in the
> statement it causes "weird" things to happen.
> I removed the reference to this field, and it's all working!
>
> Sometimes I really don't understand why it would cause other fields to
> fail, or not function properly, but ntext fields are just not handled very
> well by DW 8.0.2. Groan.
>
> Thanks anyway Pizza.
> Nath.
>
> "PizzaGood" <PizzaGood@earthlink.com> wrote in message
> news:ejfe3j$rp7$1@forums.macromedia.com...
>>I think the problem has to do with your logic.
>>
>> Can you give us some examples of the values for a record, specifically
>> the values for
>>
>> - COMPLETEORDER
>> - PAIDORDER
>>
>> Like:
>>
>> - a paid order looks like this:
>> - a complete order looks like this:
>>
>>
>>
>>
>> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
>> news:ejfc53$pgm$1@forums.macromedia.com...
>>> Hoping someone can help me with this. I have three database tables,
>>> orderdetails, paidorders, ordercomplete and the following recordset:
>>>
>>> <%
>>> Dim rsOrderSearch
>>> Dim rsOrderSearch_cmd
>>> Dim rsOrderSearch_numRows
>>>
>>> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
>>> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
>>> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
>>> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
>>> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
>>> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
>>> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
>>> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR
>>> itemdescription LIKE ? ORDER BY orderdate DESC"
>>> rsOrderSearch_cmd.Prepared = true
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
>>> rsOrderSearch__MMColParam) ' adDouble
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
>>> rsOrderSearch__MMColParam1) ' adDouble
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
>>> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>>>
>>> Set rsOrderSearch = rsOrderSearch_cmd.Execute
>>> rsOrderSearch_numRows = 0
>>> %>
>>>
>>> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
>>> would have a COUNT value of 1), I want to display "Completed".
>>> If the orderID appears in the paidorders table (thus PAIDORDER would
>>> have a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
>>> For everything else, I want to display "Open Job".
>>>
>>> For some reason, the following doesn't display the "Awaiting
>>> Pickup/Delivery" option, but seems to be displaying "Completed"
>>> correctly.
>>> I've tried various combinations, but it looks correct to me! Is it?:
>>>
>>> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
>>> <span class="greentext">Completed</span>
>>> <%Else%>
>>> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
>>> <span class="orangetext">Awaiting Pickup/Delivery</span>
>>> <%Else%>
>>> <span class="redtext">Open Job</span>
>>> <%End If%>
>>> <%End If%>
>>>
>>> Also, the above code is in a table cell within a repeat region. If I
>>> move this to a different table cell within the same repeat region, it
>>> doesn't display at all! This seems more like a bug to be honest, but
>>> considering the above code doesn't work, I'm wondering if that is the
>>> reason?
>>>
>>> If anyone can help, I'd really appreciate it. Thanks.
>>> Regards
>>> Nath.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 15, 2006 Nov 15, 2006
It's not DW - it's ADO. TEXT/NTEXT are handled one way, and all other types
are handled another. It has to do with when and how the data is retrieved,
and the details are headache-inducing.


Using a client-side cursor would also work since the data is all retrieved,
not retrieved as needed.
"tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
news:ejfef7$sat$1@forums.macromedia.com...
> Hi,
>
> I'm hoping there's nothing wrong with my logic, but I think I've spotted
> the problem!
>
> Within that recordset, there is a field called "deliverdetails". This is
> an ntext field in my database.
> Because this doesn't appear as the last field in the list of fields in the
> statement it causes "weird" things to happen.
> I removed the reference to this field, and it's all working!
>
> Sometimes I really don't understand why it would cause other fields to
> fail, or not function properly, but ntext fields are just not handled very
> well by DW 8.0.2. Groan.
>
> Thanks anyway Pizza.
> Nath.
>
> "PizzaGood" <PizzaGood@earthlink.com> wrote in message
> news:ejfe3j$rp7$1@forums.macromedia.com...
>>I think the problem has to do with your logic.
>>
>> Can you give us some examples of the values for a record, specifically
>> the values for
>>
>> - COMPLETEORDER
>> - PAIDORDER
>>
>> Like:
>>
>> - a paid order looks like this:
>> - a complete order looks like this:
>>
>>
>>
>>
>> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
>> news:ejfc53$pgm$1@forums.macromedia.com...
>>> Hoping someone can help me with this. I have three database tables,
>>> orderdetails, paidorders, ordercomplete and the following recordset:
>>>
>>> <%
>>> Dim rsOrderSearch
>>> Dim rsOrderSearch_cmd
>>> Dim rsOrderSearch_numRows
>>>
>>> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
>>> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
>>> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
>>> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
>>> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
>>> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
>>> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
>>> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR
>>> itemdescription LIKE ? ORDER BY orderdate DESC"
>>> rsOrderSearch_cmd.Prepared = true
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
>>> rsOrderSearch__MMColParam) ' adDouble
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
>>> rsOrderSearch__MMColParam1) ' adDouble
>>> rsOrderSearch_cmd.Parameters.Append
>>> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
>>> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>>>
>>> Set rsOrderSearch = rsOrderSearch_cmd.Execute
>>> rsOrderSearch_numRows = 0
>>> %>
>>>
>>> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
>>> would have a COUNT value of 1), I want to display "Completed".
>>> If the orderID appears in the paidorders table (thus PAIDORDER would
>>> have a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
>>> For everything else, I want to display "Open Job".
>>>
>>> For some reason, the following doesn't display the "Awaiting
>>> Pickup/Delivery" option, but seems to be displaying "Completed"
>>> correctly.
>>> I've tried various combinations, but it looks correct to me! Is it?:
>>>
>>> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
>>> <span class="greentext">Completed</span>
>>> <%Else%>
>>> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
>>> <span class="orangetext">Awaiting Pickup/Delivery</span>
>>> <%Else%>
>>> <span class="redtext">Open Job</span>
>>> <%End If%>
>>> <%End If%>
>>>
>>> Also, the above code is in a table cell within a repeat region. If I
>>> move this to a different table cell within the same repeat region, it
>>> doesn't display at all! This seems more like a bug to be honest, but
>>> considering the above code doesn't work, I'm wondering if that is the
>>> reason?
>>>
>>> If anyone can help, I'd really appreciate it. Thanks.
>>> Regards
>>> Nath.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 16, 2006 Nov 16, 2006
Hi,

Relating this to my other more recent post about the crash when udpating
site cache, do you think that this:

<%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
<span class="greentext">Completed</span>
<%Else%>
<%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
<span class="orangetext">Awaiting Pickup/Delivery</span>
<%Else%>
<span class="redtext">Open Job</span>
<%End If%>
<%End If%>

...would be sufficient to corrupt my site, or site cache (or whatever it
is!)? I had suspected my own personalisation of DW's MM_Username to
MM_Username1 was causing the problem but, having just spent an hour editing
every file within the sub-directory that is causing the problems, in Notepad
(because DW crashes when I open them), and renaming my MM_Username1 back to
MM_Username, I notice that DW is still crashing. So I have ruled out the
MM_Username because this had been working fine anyway, up to yesterday.

So...the only other thing I've done on the site is to add this:

<%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
<span class="greentext">Completed</span>
<%Else%>
<%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
<span class="orangetext">Awaiting Pickup/Delivery</span>
<%Else%>
<span class="redtext">Open Job</span>
<%End If%>
<%End If%>

Would this crash my site cache? I'm really at a loss as to what has
happened.
Can you have two COUNT(*) .... AS suchandsuch in one SELECT statement? I
wondered if that was maybe it.

Would appreciate your help because, as it stands, I can't open this
sub-directory in DW.

Thanks
Nath.

"Lionstone" <HIDElionstone@HIDEhushmail.com> wrote in message
news:ejfic5$3ib$1@forums.macromedia.com...
> It's not DW - it's ADO. TEXT/NTEXT are handled one way, and all other
> types are handled another. It has to do with when and how the data is
> retrieved, and the details are headache-inducing.
>
>
> Using a client-side cursor would also work since the data is all
> retrieved, not retrieved as needed.
> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
> news:ejfef7$sat$1@forums.macromedia.com...
>> Hi,
>>
>> I'm hoping there's nothing wrong with my logic, but I think I've spotted
>> the problem!
>>
>> Within that recordset, there is a field called "deliverdetails". This is
>> an ntext field in my database.
>> Because this doesn't appear as the last field in the list of fields in
>> the statement it causes "weird" things to happen.
>> I removed the reference to this field, and it's all working!
>>
>> Sometimes I really don't understand why it would cause other fields to
>> fail, or not function properly, but ntext fields are just not handled
>> very well by DW 8.0.2. Groan.
>>
>> Thanks anyway Pizza.
>> Nath.
>>
>> "PizzaGood" <PizzaGood@earthlink.com> wrote in message
>> news:ejfe3j$rp7$1@forums.macromedia.com...
>>>I think the problem has to do with your logic.
>>>
>>> Can you give us some examples of the values for a record, specifically
>>> the values for
>>>
>>> - COMPLETEORDER
>>> - PAIDORDER
>>>
>>> Like:
>>>
>>> - a paid order looks like this:
>>> - a complete order looks like this:
>>>
>>>
>>>
>>>
>>> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
>>> news:ejfc53$pgm$1@forums.macromedia.com...
>>>> Hoping someone can help me with this. I have three database tables,
>>>> orderdetails, paidorders, ordercomplete and the following recordset:
>>>>
>>>> <%
>>>> Dim rsOrderSearch
>>>> Dim rsOrderSearch_cmd
>>>> Dim rsOrderSearch_numRows
>>>>
>>>> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
>>>> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
>>>> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
>>>> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
>>>> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
>>>> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
>>>> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
>>>> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR
>>>> itemdescription LIKE ? ORDER BY orderdate DESC"
>>>> rsOrderSearch_cmd.Prepared = true
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
>>>> rsOrderSearch__MMColParam) ' adDouble
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
>>>> rsOrderSearch__MMColParam1) ' adDouble
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
>>>> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>>>>
>>>> Set rsOrderSearch = rsOrderSearch_cmd.Execute
>>>> rsOrderSearch_numRows = 0
>>>> %>
>>>>
>>>> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
>>>> would have a COUNT value of 1), I want to display "Completed".
>>>> If the orderID appears in the paidorders table (thus PAIDORDER would
>>>> have a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
>>>> For everything else, I want to display "Open Job".
>>>>
>>>> For some reason, the following doesn't display the "Awaiting
>>>> Pickup/Delivery" option, but seems to be displaying "Completed"
>>>> correctly.
>>>> I've tried various combinations, but it looks correct to me! Is it?:
>>>>
>>>> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
>>>> <span class="greentext">Completed</span>
>>>> <%Else%>
>>>> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
>>>> <span class="orangetext">Awaiting Pickup/Delivery</span>
>>>> <%Else%>
>>>> <span class="redtext">Open Job</span>
>>>> <%End If%>
>>>> <%End If%>
>>>>
>>>> Also, the above code is in a table cell within a repeat region. If I
>>>> move this to a different table cell within the same repeat region, it
>>>> doesn't display at all! This seems more like a bug to be honest, but
>>>> considering the above code doesn't work, I'm wondering if that is the
>>>> reason?
>>>>
>>>> If anyone can help, I'd really appreciate it. Thanks.
>>>> Regards
>>>> Nath.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 16, 2006 Nov 16, 2006
LATEST
Sorted this now...problem with a re-direct URL! Nothing to do with any of
the code in the page OR the MM_Username1 thang! :o)

Nath.

"Lionstone" <HIDElionstone@HIDEhushmail.com> wrote in message
news:ejfic5$3ib$1@forums.macromedia.com...
> It's not DW - it's ADO. TEXT/NTEXT are handled one way, and all other
> types are handled another. It has to do with when and how the data is
> retrieved, and the details are headache-inducing.
>
>
> Using a client-side cursor would also work since the data is all
> retrieved, not retrieved as needed.
> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
> news:ejfef7$sat$1@forums.macromedia.com...
>> Hi,
>>
>> I'm hoping there's nothing wrong with my logic, but I think I've spotted
>> the problem!
>>
>> Within that recordset, there is a field called "deliverdetails". This is
>> an ntext field in my database.
>> Because this doesn't appear as the last field in the list of fields in
>> the statement it causes "weird" things to happen.
>> I removed the reference to this field, and it's all working!
>>
>> Sometimes I really don't understand why it would cause other fields to
>> fail, or not function properly, but ntext fields are just not handled
>> very well by DW 8.0.2. Groan.
>>
>> Thanks anyway Pizza.
>> Nath.
>>
>> "PizzaGood" <PizzaGood@earthlink.com> wrote in message
>> news:ejfe3j$rp7$1@forums.macromedia.com...
>>>I think the problem has to do with your logic.
>>>
>>> Can you give us some examples of the values for a record, specifically
>>> the values for
>>>
>>> - COMPLETEORDER
>>> - PAIDORDER
>>>
>>> Like:
>>>
>>> - a paid order looks like this:
>>> - a complete order looks like this:
>>>
>>>
>>>
>>>
>>> "tradmusic.com" <sales@NOSHPAMtradmusic.com> wrote in message
>>> news:ejfc53$pgm$1@forums.macromedia.com...
>>>> Hoping someone can help me with this. I have three database tables,
>>>> orderdetails, paidorders, ordercomplete and the following recordset:
>>>>
>>>> <%
>>>> Dim rsOrderSearch
>>>> Dim rsOrderSearch_cmd
>>>> Dim rsOrderSearch_numRows
>>>>
>>>> Set rsOrderSearch_cmd = Server.CreateObject ("ADODB.Command")
>>>> rsOrderSearch_cmd.ActiveConnection = MM_connNAME_STRING
>>>> rsOrderSearch_cmd.CommandText = "SELECT orderID, (SELECT COUNT(*) FROM
>>>> dbo.tblpaidorders WHERE dbo.qryorderdetails.orderID =
>>>> dbo.tblpaidorders.orderID) AS PAIDORDER, (SELECT COUNT(*) FROM
>>>> dbo.tblordercomplete WHERE dbo.qryorderdetails.orderID =
>>>> dbo.tblordercomplete.orderID) AS COMPLETEORDER, itemdescription FROM
>>>> dbo.qryorderdetails WHERE orderID = ? OR customerID = ? OR
>>>> itemdescription LIKE ? ORDER BY orderdate DESC"
>>>> rsOrderSearch_cmd.Prepared = true
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param1", 5, 1, -1,
>>>> rsOrderSearch__MMColParam) ' adDouble
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param2", 5, 1, -1,
>>>> rsOrderSearch__MMColParam1) ' adDouble
>>>> rsOrderSearch_cmd.Parameters.Append
>>>> rsOrderSearch_cmd.CreateParameter("param3", 200, 1, 255, "%" +
>>>> rsOrderSearch__MMColParam2 + "%") ' adVarChar
>>>>
>>>> Set rsOrderSearch = rsOrderSearch_cmd.Execute
>>>> rsOrderSearch_numRows = 0
>>>> %>
>>>>
>>>> If the orderID appears in the ordercomplete table (thus COMPLETEORDER
>>>> would have a COUNT value of 1), I want to display "Completed".
>>>> If the orderID appears in the paidorders table (thus PAIDORDER would
>>>> have a COUNT value of 1), I want to display "Awaiting Pickup/Delivery".
>>>> For everything else, I want to display "Open Job".
>>>>
>>>> For some reason, the following doesn't display the "Awaiting
>>>> Pickup/Delivery" option, but seems to be displaying "Completed"
>>>> correctly.
>>>> I've tried various combinations, but it looks correct to me! Is it?:
>>>>
>>>> <%IF (rsOrderSearch.Fields.Item("COMPLETEORDER").Value) > 0 Then%>
>>>> <span class="greentext">Completed</span>
>>>> <%Else%>
>>>> <%IF (rsOrderSearch.Fields.Item("PAIDORDER").Value) > 0 Then%>
>>>> <span class="orangetext">Awaiting Pickup/Delivery</span>
>>>> <%Else%>
>>>> <span class="redtext">Open Job</span>
>>>> <%End If%>
>>>> <%End If%>
>>>>
>>>> Also, the above code is in a table cell within a repeat region. If I
>>>> move this to a different table cell within the same repeat region, it
>>>> doesn't display at all! This seems more like a bug to be honest, but
>>>> considering the above code doesn't work, I'm wondering if that is the
>>>> reason?
>>>>
>>>> If anyone can help, I'd really appreciate it. Thanks.
>>>> Regards
>>>> Nath.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines