473,435 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,435 software developers and data experts.

like statment

Fary4u
273 100+
Hi

i'm trying to search the value in my following field. i don't know why it's giving me this error

Expand|Select|Wrap|Line Numbers
  1. select * FROM products WHERE (products.CatalogID='" & strCatalogID & "') AND (products.productDescc like '%"&styno&"%'") ")
  2.  
without wildcard it's works fine but wd wildcard gives error
Unterminated string constant. ?
Jun 7 '09 #1
4 1703
Fary4u
273 100+
yes sorted but executed query but no result found ?

Expand|Select|Wrap|Line Numbers
  1. select * FROM products WHERE (products.CatalogID='" & strCatalogID & "') AND (products.productDescc like '%" & styno & "%') ")
  2.  
still can't find the styno value
Jun 7 '09 #2
Atli
5,058 Expert 4TB
Hi.

Can you show us what the query looks like after you construct it?

Meaning:
Expand|Select|Wrap|Line Numbers
  1. Dim colValue As String = "someValue"
  2. Dim sql As String = "SELECT * FROM myTbl WHERE col = '" & colValue & "'"
  3.  
  4. Response.Write(sql) ' What would this show you?
  5.  
Jun 7 '09 #3
Fary4u
273 100+
Hi thanks for ur reply

the problem is not in query anymore it's bring the result but it's not searching value in the variable but variable values passing parameters ? ? ? ?

i'm very much confused wht's going on ? ? ?

my DB Values like this

Expand|Select|Wrap|Line Numbers
  1. CatalogID  |  productDess
  2. 1  |  x / y / z
  3. 2  |  A / B / C
  4. 3  |  1 / 2 / 3
  5.  
result should b like this
Expand|Select|Wrap|Line Numbers
  1. (CatalogID='2') AND (productDescc like '%B%') 
  2.  
coding
Expand|Select|Wrap|Line Numbers
  1. select * FROM products WHERE (products.CatalogID='" & strCatalogID & "') AND (products.productDescc like '%" & styno & "%') ")
  2.  
it's working fine & donig the same i would like to do but not returning value from " B " result
Jun 7 '09 #4
Atli
5,058 Expert 4TB
That query, executed against that data (overlooking the column name typo) should only return the second row

@Fary4u
I'm afraid I don't understand what you are saying here.
Could you try to explain this a little better?

Aside from that, there are a couple of things that you might want to look into.
  1. Numeric values in queries should not be quoted, like your CatalogID.
    It should be
    Expand|Select|Wrap|Line Numbers
    1. (CatalogID=2)
    (Assuming CatalogID is an integer)

  2. Your productDescc column is storing multiple values.
    This violates the most basic rule of relational database design.
    Each field should only contain a single value, and never a list of values.
    See this article on Database Normalization and Table Structures to learn more.
Jun 7 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: e_AK_05 | last post by:
I have a question and I can't figure out how to do it. I have a select statment : SELECT table1.* AS table1.*, table2.* AS table2.* FROM table1, table2 WHERE 1 this does not work...for me at...
9
by: Appel | last post by:
Hallo i have a problem to add to string with a SQL statement. My Table : Tablename NAMES: | Name1 | Name2 | Name3 | John Meyer I search for a SQL statment that update Name3.
1
by: Maria | last post by:
Hello I have not used db2 in a long time, and I have this very long insert script, which is giving me an error of duplicated inserts. My question is how can I put something in the statment so...
2
by: 73blazer | last post by:
Perhaps my thinking is wrong but this is what I have: 1 table (Tab1) with 1 attribute (Attr1) Attr1 char(16) for bit data ----------------------------------------------- create trigger...
5
by: orencs | last post by:
Hello, I am using Microsoft.Practices.EnterpriseLibrary.Data. I am running the following sqlCommand = "SELECT var1 FROM table1 WHERE var2 IN (4,5,6) ; SELECT var3 FROM table2 WHERE var2 IN...
10
by: --------- | last post by:
What is the use of (return ) statment in functions? in fact i have got mess with function can't catch it feel lost?
8
by: Belee | last post by:
I have the following code and it is not passing through the Next statement: Private Function IsItemAlreadyAdded() As Boolean Dim drMyRow As DataRow With Me For Each drMyRow In...
1
by: Anton Nikiforov | last post by:
Dear All, could you please help me with writing select statment for the following: I have two tables dictionary_text label| Text -----+------------------------ 23 | General 24 | Internet...
8
by: lvpaul | last post by:
Hello ! I habe 2 Tables Table1: Orders Fields: Ordernr, Opieces Table2: Calloffs Ordernr, Cpieces
1
by: zeebiggie | last post by:
Good morning I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.