|
 |
asp_databases thread: comparing strings?
Message #1 by "Nick Middleweek" <nickm@t...> on Thu, 24 Aug 2000 10:25:52 +0000
|
|
Hello,
I'm trying to compare strings and do something if they are the same.
I've done a search on a table and got back the RS.
I'm now looping through the records
While Not ObjRS.EOF
If ((objRS("Prod_Grp")="Prof TC") OR(objRS("Prod_Grp")="Prof HSS") OR
(objRS("Prod_Grp")="Craft TC"))
Reponse.Write(objRS("Product_Code"))
End If
Wend
I can't get it to work, it just displays nothing but I know most of the
products searched are in the groups.
Could someone help us with this?
Perhaps I'm using VBScript wrong?
The data in the fields may contain spaces after the last letter and they may
not all be in the same case so I also need a wildcard check at the end.
I was think of putting the Prod_Grp check as part of the search but couldn't
get my head round the query.
I'm doing an AND search on about 5 other fields so I suppose I would need to
slip in the OR prod_grp bit as aprt of that - I got lost which is why I'd do
the check in the loop.
TIA
Nick Middleweek
Message #2 by "Nick Middleweek" <nickm@t...> on Thu, 24 Aug 2000 11:53:33 +0000
|
|
I managed to get this working OK now - I never realised the = symbol checks
for case sensitive as well! I simply used UCase on the field and compared it
against "PROF TC", etc.
I'd appreciate some feedback on getting this part of the Query though!
Regards
Nick Middleweek
----------
>From: "Nick Middleweek"
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] comparing strings?
>Date: Thu, Aug 24, 2000, 10:25
>
> Hello,
>
> I'm trying to compare strings and do something if they are the same.
>
> I've done a search on a table and got back the RS.
>
> I'm now looping through the records
>
> While Not ObjRS.EOF
> If ((objRS("Prod_Grp")="Prof TC") OR(objRS("Prod_Grp")="Prof HSS") OR
> (objRS("Prod_Grp")="Craft TC"))
> Reponse.Write(objRS("Product_Code"))
> End If
> Wend
>
> I can't get it to work, it just displays nothing but I know most of the
> products searched are in the groups.
>
> Could someone help us with this?
> Perhaps I'm using VBScript wrong?
> The data in the fields may contain spaces after the last letter and they may
> not all be in the same case so I also need a wildcard check at the end.
>
> I was think of putting the Prod_Grp check as part of the search but couldn't
> get my head round the query.
>
> I'm doing an AND search on about 5 other fields so I suppose I would need to
> slip in the OR prod_grp bit as aprt of that - I got lost which is why I'd do
> the check in the loop.
>
>
> TIA
> Nick Middleweek
>
Message #3 by smartin@c... on Thu, 24 Aug 2000 11:37:04 -0400
|
|
Nick:
Post your current SQL string and I'll take a stab at it...
-Stephen
> -----Original Message-----
> From: Nick Middleweek
> Sent: Thursday, August 24, 2000 7:54 AM
> To: ASP Databases
> Subject: [asp_databases] Re: comparing strings?
>
>
> I managed to get this working OK now - I never realised the =
> symbol checks
> for case sensitive as well! I simply used UCase on the field
> and compared it
> against "PROF TC", etc.
>
> I'd appreciate some feedback on getting this part of the Query though!
>
>
> Regards
> Nick Middleweek
>
> ----------
> >From: "Nick Middleweek"
> >To: "ASP Databases" <asp_databases@p...>
> >Subject: [asp_databases] comparing strings?
> >Date: Thu, Aug 24, 2000, 10:25
> >
>
> > Hello,
> >
> > I'm trying to compare strings and do something if they are the same.
> >
> > I've done a search on a table and got back the RS.
> >
> > I'm now looping through the records
> >
> > While Not ObjRS.EOF
> > If ((objRS("Prod_Grp")="Prof TC")
> OR(objRS("Prod_Grp")="Prof HSS") OR
> > (objRS("Prod_Grp")="Craft TC"))
> > Reponse.Write(objRS("Product_Code"))
> > End If
> > Wend
> >
> > I can't get it to work, it just displays nothing but I know
> most of the
> > products searched are in the groups.
> >
> > Could someone help us with this?
> > Perhaps I'm using VBScript wrong?
> > The data in the fields may contain spaces after the last
> letter and they may
> > not all be in the same case so I also need a wildcard check
> at the end.
> >
> > I was think of putting the Prod_Grp check as part of the
> search but couldn't
> > get my head round the query.
> >
> > I'm doing an AND search on about 5 other fields so I
> suppose I would need to
> > slip in the OR prod_grp bit as aprt of that - I got lost
> which is why I'd do
> > the check in the loop.
> >
> >
> > TIA
> > Nick Middleweek
> >
>
Message #4 by "Nick Middleweek" <nickm@t...> on Fri, 25 Aug 2000 11:04:34 +0000
|
|
SELECT * FROM tblProductExtension WHERE (Cutter_Type='straight_') AND
(Shank_Diameter='1/4') AND (Grade='TCT') AND (Active='Y') AND
((Product_Group='Prof TC') OR (Product_Group='Prof HSS') OR
(Product_Group='Craft TC')) ORDER BY Product_Code
Below is the table structure.
{Product_Code] [varchar] (15) N
[Product_Group] [varchar] (50) NULL,
[Dia_Imperial] [varchar] (20) NULL,
[Cut_Len_Imperial] [varchar] (20) NULL,
[Dia_Metric] [varchar] (20) NULL,
[Dia2_Metric] [varchar] (20) NULL,
[Cut_Len_Metric] [varchar] (20) NULL
[Shank_Diameter] [varchar] (12) NULL ,
[Overall_Len_Metric] [varchar] (20) NULL ,
[Bearing_Dia_Metric] [varchar] (20) NULL ,
[Rebate_Metric] [varchar] (20) NULL ,
[Radius_1] [varchar] (20) NULL ,
[Radius_2] [varchar] (20) NULL ,
[Cutter_Type] [varchar] (32) NULL ,
[Range] [varchar] (20) NULL ,
[Grade] [varchar] (10) N
[Angle] [varchar] (20) NULL ,
[Guide] [varchar] (26) NULL ,
[DescriptionGK] [varchar] (55) NULL ,
[Comment] [varchar] (8000) NULL ,
[List_Price] [real] NULL ,
[VAT_Code] [varchar] (10) NULL ,
[Description] [varchar] (50) NULL ,
[Physical_Qty] [int] NULL ,
[Allocated_Qty] [int] NULL ,
[BackOrder_Qty] [int] NULL ,
[Stock_Level] [int] NULL ,
[BackInStock] [varchar] (30) NULL ,
[Dimensions] [varchar] (8000) NULL ,
[Promotion] [varchar] (80) NULL ,
[SparePartsDiagram] [varchar] (80) NULL ,
[NewFlag] [datetime] NULL ,
[CataloguePage] [varchar] (30) NULL ,
[Image_URL_1] [varchar] (80) NULL ,
[Image_URL_2] [varchar] (80) NULL ,
[MainSitePage_URL_1] [varchar] (80) NULL ,
[MainSitePage_URL_2] [varchar] (80) NULL ,
[PDF_URL] [varchar] (80) NULL ,
[AssociatedProducts_1] [varchar] (15) NULL ,
[AssociatedProducts_2] [varchar] (15) NULL ,
[AssociatedProducts_3] [varchar] (15) NULL ,
[AssociatedProducts_4] [varchar] (15) NULL ,
[AssociatedProducts_5] [varchar] (15) NULL ,
[FAQ_1] [varchar] (25) NULL ,
[FAQ_2] [varchar] (25) NULL ,
[FAQ_3] [varchar] (25) NULL ,
[FAQ_4] [varchar] (25) NULL ,
[FAQ_5] [varchar] (25) NULL ,
[AlternateProduct_1] [varchar] (18) NULL ,
[AlternateProduct_2] [varchar] (18) NULL ,
[AlternateProduct_3] [varchar] (18) NULL ,
[Active_1] [varchar] (1) NULL ,
[Active_2] [varchar] (1) NULL ,
[convert13] [varchar] (20) NULL ,
[convert12] [varchar] (20) NULL ,
[convert11] [varchar] (20) NULL ,
[convert10] [varchar] (20) NULL ,
[convert9] [varchar] (20) NULL ,
[convert8] [varchar] (20) NULL ,
[convert7] [varchar] (20) NULL ,
[convert6] [varchar] (20) NULL ,
[convert5] [varchar] (20) NULL ,
[convert3] [varchar] (20) NULL ,
[convert2] [varchar] (20) NULL ,
[convert1] [varchar] (20) NULL
Is there a way to speed up the search?
Thanks for an feedback!
Regards
Nick
----------
> Nick:
>
> Post your current SQL string and I'll take a stab at it...
>
> -Stephen
>
>> -----Original Message-----
>> I managed to get this working OK now - I never realised the
>> symbol checks
>> for case sensitive as well! I simply used UCase on the field
>> and compared it
>> against "PROF TC", etc.
>>
>> I'd appreciate some feedback on getting this part of the Query though!
>>
>>
>> Regards
>> Nick Middleweek
>>
>> ----------
>> > Hello,
>> >
>> > I'm trying to compare strings and do something if they are the same.
>> >
>> > I've done a search on a table and got back the RS.
>> >
>> > I'm now looping through the records
>> >
>> > While Not ObjRS.EOF
>> > If ((objRS("Prod_Grp")="Prof TC")
>> OR(objRS("Prod_Grp")="Prof HSS") OR
>> > (objRS("Prod_Grp")="Craft TC"))
>> > Reponse.Write(objRS("Product_Code"))
>> > End If
>> > Wend
>> >
>> > I can't get it to work, it just displays nothing but I know
>> most of the
>> > products searched are in the groups.
>> >
>> > Could someone help us with this?
>> > Perhaps I'm using VBScript wrong?
>> > The data in the fields may contain spaces after the last
>> letter and they may
>> > not all be in the same case so I also need a wildcard check
>> at the end.
>> >
>> > I was think of putting the Prod_Grp check as part of the
>> search but couldn't
>> > get my head round the query.
>> >
>> > I'm doing an AND search on about 5 other fields so I
>> suppose I would need to
>> > slip in the OR prod_grp bit as aprt of that - I got lost
>> which is why I'd do
>> > the check in the loop.
>> >
>> >
>> > TIA
>> > Nick Middleweek
>> >
>>
>
> ---
> You are currently subscribed to asp_databases
>
|
|
 |