473,394 Members | 1,679 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,394 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 1702
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.