I am working in school projet.

I have made a database and also search from database, everything is fine...

But I want to know how in search I can retrive exact parameter.

eg:

suppose in TaxtBox1.Text = "VI"

then the search result must come "VI" only not "VII"/"VIII"

Kindly help

The answer is "it depends". It depends on the type of database (Access, SQL, mySQL, etc), and it depends on the actual data in the field. You can use wildcards in SQL queries such that if your query looks like

select * from myTable where MovieName like 'Rocky%'

then the returned records will be Rocky, Rocky II, etc. If you only want movies with VI (but not VII, etc) then the query

select * from myTable where MovieName like '% VI'

Note that you need the blank after '%' so that you don't match (for example) 'Halloween XVI'

commented: Thank you Sir.. +0

and you can use this query also.

select * from myTable where MovieName = 'VI'

Regards

Well, yeah. If you want to answer the question he actually asked (DOH!)

Dear Sir,

As i am working in VB using ACCESS Database.

I Have used ***

select * from myTable where

select * from myTable where
CLASS LIKE ? + '%'***

When I use it as ***select * from myTable where CLASS LIKE '% VI' ***; its not functioning at all; kindly help

MY code are:

SELECT STUDENT_ID, [SESSION], ADMISSION_NO, ADMISSION_DATE, FIRST_NAME, LAST_NAME, CLASS, [SECTION], ROLL_NO, GENDER, DATE_OF_BIRTH, CATEGORIES,
BLOOD_GROUP, RELIGION, ADDRESS, FATHERS_NAME, MOTHERS_NAME, CONTACT_NO, GUARDIAN_NAME, RELATIONSHIP, GUARDIAN_CONTACT_NO,
FILE_REFERNCE_NO, STATUS
FROM student
WHERE (CLASS LIKE ? + '%')

Access uses different wildcards than SQL. In Access, an asterisk matches any characters whereas SQL uses the percent sign. To match any single character in Access, use a question mark. SQL uses an underscore. So the statement

select * from myTable where CLASS LIKE '* VI'

will select all records where CLASS ends with " VI"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.