Searching Database Field

I want to search 2 of my database fields (title and description) for search terms entered in a form. I can do a 'LIKE' but how do I cover searching for each word in the string that has been submitted? For example, if someone searches for 'World Cup Final', I want to search both database fields for 'world', 'cup' and 'final'.

View Replies


ADVERTISEMENT

Searching A Field

I have a database which has a field called "title". I have made a text input box and set that user submitted text to a variable (call it textvar). How do I say something like this...?

Set rs = conn.execute("Select * from workitem where title contains '" &textvar& "' " )

Of course the word contains is just a guess on my part.. other ideas are "is like". What function/syntax will give me what I want, which is for it to return any title that has the words entered by the user?

View Replies View Related

Searching Where Form Variable Equals Data Field

I get a "data type mismatch error". I assume it is because this is a number, but I don't know what to change.

<%
dim cnStr
dim rcSet
dim frmSSN
dim sqlStr

'store form input into variables
frmSSN = Request.Form("SSN")

'create connection and recordset objects
Set cnStr = Server.CreateObject("ADODB.Connection")
Set rcSet = Server.CreateObject("ADODB.Recordset")

' defining database connection (connectionstring2.inc)
cnStr.ConnectionString = path
cnStr.Provider = provider
cnStr.open
%>

<%
SQL_query = "SELECT * FROM Orders WHERE Driver = '" & frmSSN & "'"
Set RS = cnStr.Execute(SQL_query)
WHILE NOT RS.EOF
%>

View Replies View Related

Searching In Database

I need help in retreiving data from database. my form consists of some checkboxes,
for eg:- in my form for location three check boxes are there and for the type of house four checkboxes.(houses,apartments,offices etc).Below is my form,

London (north of river)
(checkbox here)Central London
(checkbox here) Docklands
(checkbox here)Ealing, Chiswick & Acton


Number of Bedrooms(text box here)

(checkbox here)Houses
(checkbox here)Apartments
(checkbox here)Developments & Land
(checkbox here)Commercial

My databse consists of all this information. If the user want 2 bedroom flat or apartment in central london he will check central london, 2 bedrooms, house and apartment. for this i need an sql query to retrieve from database the appropriate property they are finding.

View Replies View Related

Searching The Database

I have a code that compares the value in the textfeild of a form with the value in the database table

do until rsData.EOF
if trim(rsData("core_contact_fname"))=trim(request.form("txtNumber1")) then%>

i would like to do two things to it one is to compare the two values while ignoring their cases(ignore case) i am not sure how to use the ignore case function.

I also want it to comapre if i want to search for say"L" I should get all the names starting with L from the database.

View Replies View Related

Searching Database

I have a website running asp (about to move to asp.net soon though) which has a list of DVD's I have the various pages I want, last 10, listing, full listing ect, but the one page i can't figure out is a search page. I have read various books, but none have given any tips on how to make a search page for a access DB.

View Replies View Related

Searching A Database

I did a quick search on this (insert ironic comment) but cannot find anything appropriate. What I have is a site running out of an access database, holding roughly 150+ pages in the same format, i.e. a page header, content text, and the date it was published.

What I want to do is to have a search form where a user can insert keywords, and the search script then queries the database and pulls out links to the pages (or database entries, obviously) that match the query. I've tried another script but this only searches for .htm or .html files within the directory my site is housed in. Is there a tutorial/direction anyone can point me to in order to achieve this?

View Replies View Related

Searching Database Using An Array

I have the following code and nee to know how to make it return all records where sha is equal to any of the values in the array I have defined. Code:

View Replies View Related

Page 2 - Searching Database Using ASP

I get the following error:

Command text was not set for the command object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Command text was not set for the command object. Code:

View Replies View Related

Searching A Database Using The Name Of Person

I want to search my database using a person's name. My names are separated into 'First' and 'Last' name fields.

The SQL I'm using so far works if you search only by the first name, or only by the surname, but if you enter both names, it comes back with no results.

How do you do it so that it will work in all cases?

Here's my code:

Sql = "SELECT * FROM kbs, authors WHERE authors.authorID = kbs.author"

If Request.Form("TypeSearch") = "author" Then
Sql = Sql & " AND (authors.authorLastName LIKE '%" & Request.Form("kbsSearch") & "%' OR authors.authorFirstName LIKE '%" & Request.Form("kbsSearch") & "%')"
End If

set rs = Server.CreateObject("ADODB.Recordset")
set rs=conn.execute(Sql)

View Replies View Related

Code For Searching A Database.

Basically i have one table and i want to search it by what the user types in the search bar/text box.

View Replies View Related

Searching All Database Tables

How can ASP be used to search through a database that has multiple tables in it? I want to be able to enter a string into a field in an ASP page and the resultant tables to be listed in a table or list on an asp page. It might be the same page or another. I know it can be done - but I can't link the concepts or code together.

View Replies View Related

Searching Database With 'phrase', 'allwords' Etc.

I'd like to give the visitor the option of searching my database entries, for: 'all words', 'the phrase', 'any word' etc. Code:

View Replies View Related

Searching Database With Multiple Text Boxes?

The user can search the database when they put in a date, that works fine, but when i put in another text box to search the database for a certain date range Code:

View Replies View Related

Field In A Database

I'm trying to upload the entire field for every recordset to &nbsp;. How could I do this? Here's what I got so far.

<!--#include file="searchconn.asp"-->
<%
UPDATE SearchTable SET SearchTable.newscontent = "&nbsp;";
%>

View Replies View Related

Access Database Field Name

I have an access database with year designations for field names, such 2005 2004 2003 ... and data corresponding thereto. I can formulate a query in MSAccess and it works just fine. However, I am trying to create a web page that will create a database
connection and use SQL to create a recordset(s) which I can then manipulate in vbScript.

The problem seems to be structuring a query that will work in
vbScript. I have tried several combinations:

rs2.Open "SELECT 2005,2004,2003 FROM Table", conn, adOpenStatic, adLockOptimistic
rs2.Open "SELECT '2005','2004','2003' FROM Table", conn, adOpenStatic, adLockOptimistic
rs2.Open "SELECT "2005","2004","2003" FROM Table", conn, adOpenStatic, adLockOptimistic

but none of these will extract data.

I have also tried casting these numbers to strings in a string variable, but still no success.

Is there some naming convention I am violating by simply using year designations as field names or is there a problem with vbScript?

View Replies View Related

Database Field Types

I pass a table name into my program dynamically. I could display the data by looping through the object.Fields for both the field name and the field data using object.GetRows.
What I have not figured out is if there is a way to figure out from the Fields what type of field (ie. Numeric, Text) it is.
Certainly I could check the actual data once it is read, but is there a way to figure out the field type without doing that? Perhaps an object property of a recordset that I am not familiar with?

View Replies View Related

Ref Database Field Name With Variable

I have an asp page that has a function that connects to an Access database.
I am using Javascript. Is there any way to reference the field name in the
database through a variable in a sql statement? Code:

View Replies View Related

Database Field Names

I have a "csv file" as a database.

The 1st row contains the field names:

Orion.Accounts.AccountName,Orion.Accounts.Address1

the code I use normally works:
<%=rs("Orion.Accounts.AccountName")%>

Although in this case is doesn't because the fieldnames contain full stops.

how to modify this line:
<%=rs("Orion.Accounts.AccountName")%>

View Replies View Related

ASP If Database Field Blank - Do Nothing!

what i am trying to do is when the database field is empty to not display the box (table) that is in my css file, whereas when there's something in the field i would like the box to display!!! So i'm basically trying to get a 'when field empy, do nothing!!! my code at present generates the box no matter whether the field is full or not!!! Code:

View Replies View Related

Update A Field In A Database

I'm having a spot of trouble trying to update fields in a access database using asp. I can delete and add fields thru the asp page but when i attempt to modify the fields i get a page not found error message. Code:

View Replies View Related

Increasing The Value Of A Database Field

im trying to increase the value of an id key in my database by 1 each time i add a new record. is ther anyway i can do it using ASP?

View Replies View Related

Checking A Database Field

I have a form that inserts a student's course choices into an Access db. The student can choose from 4 options in a day. From a drop down box that is populated from the db.
Each course has a field called count1, count2, count3 and count4 which are the class sizes for those sessions. When they choose a session, I have a bit of ASP that takes '1' away from the count.

However, I need to validate the form when it is submitted so that if course = 0 a message pops up to say the course in that session is full. At the moment, the drop down boxes are populated by SQL that says only show if count>0 but if a lot of students load the page at the same time they can all subscribe to it - so I am getting -4 in some sessions. I need to check whether the course in that option is full i.e. '0' when the form is validated and then for it to tell them that that particular session is full.

View Replies View Related

Parse A Database Field

I am trying to take a name that is in a database field and rearrange it to place it in a session variable. For example:

Database Field:

SMITH, JOHN

What I would like to see:

JOHN SMITH

Instead of - Welcome SMITH, JOHN
I would prefer - Welcome JOHN SMITH

Can this be done when requesting a form variable or does it have to be done when viewing the recordset variable.

View Replies View Related

Determining If A Field In A Database Is Empty Using ASP

I am trying to determine if a field in a database is empty or not. The code I have is this....

(before this I have code that opens up the database, gets the data from the table. the var "content" holds the data if any from the database.)

if content = "" then
alert1 = "content field is empty"
else
alert1 = "content field contains text"
end if

This doesn't seem to work. I also tried...
if (content) then
alert1 = "content field is empty"
else
alert1 = "content field contains text"
end if

No luck yet. Any ideas?

View Replies View Related

Date/Time Database Field

I'm trying to post a value from a form field into a database field of type Date/Time formated to short date.

Even though the value from the form comes in short date style ie 19/06/2004 I'm getting a type mismatch error

View Replies View Related

Inserting Data Into Bit Field In An Sql Database

I have an ASP variable called IRNvar:

If IRNvar(0,num) = "True" then
IRNvar(0,num) = 1
else
IRNvar(0,num) = 0
end if

In my sql database I have a True/False field called VariantFlag which is a bit data type. The IRNvar value is numeric. I am trying to insert the 1 or 0 into the database so that the field shows true or false accordingly but I get a 'Type Mismatch' error. Here's the insert statement:

SQL = "INSERT INTO Documents (CNID, DocumentPrefix, DocCategory, DocumentName, VariantFlag, PartNo, PartDesc, NewIssue, StatusID) VALUES ('" & CNID & "', '" & IRNprefix & "', '" & IRNcat & "', '" & IRNnumber & "', " & IRNvar & ", '" & PartNum & "', '" & IRNDesc(0,num) & "', 'A', '5')"

Is there a way to convert the number to the right data type? Am I doing something wrong? I'm quite new to all this so it's probably something silly.

View Replies View Related

Database - Strange Behaviour Of One Field

I have an access database with lots of fields including a memo field called
'priecinfo'.

Everything works well, lots of data is written, but in one particular
situation, I can't get the field 'priceinfo' to write out:

1) the code below works properly except that the field 'priceinfo' doesn't
get written - replace it with any other field and it works. Code:

View Replies View Related

Calling A Database Field From Form

I have the following line of code that is part of a form that displays a record from a database;

<textarea name="name" cols="60" rows="20" value="<% =rscms_example("body") %>" </textarea>

Could you please tell me where I am going wrong on it? I know its probably very simple, but I am terrible at forms anyway.

View Replies View Related

Inserting Value From List Box Into Database Field

My question is this: how do I get a value from a listbox to assign to a variable (elementary I know)? Code:

View Replies View Related

Validate Form Field Against SQL Database

I need to validate an item number from a form field against a MS SQL database

I am using a 2 page process to print barcodes from an entered item number on page 1 and need to only use valid item numbers from the database. If they enter a wrong number I want to give them a page telling them of the error.

I have 32 fields on page 1 to enter 32 items.(one for every label on the second page that contains the barcodes. Here is the connection to the database that I am using for the barcode.(Column IMLITM contains the item numbers) Code:

View Replies View Related

Update Database Field Read Only

Trying to update 2 fields. my database is read only..

Microsoft JET Database Engine error '80040e09'

Cannot update. Database or object is read-only.

/sendd.asp, line 16

this is line 16: rsAddComments.AddNew

is this something to do with my server directory permissions?

code .....

View Replies View Related

Form Field Data From Database

I currently have a web page that pulls in job vacancies from a search form all written in asp and the database is in access. I will be placing an extra field which will say "apply now" and on selecting this you will be taken to a new page where you can fill in your details and email them to the employer.

My problem is I need to know how to get a field in the form that will automatically fill in the title of the vacancy being applied for from the database.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved