Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to search using a text field?

Status
Not open for further replies.

Skinsella

Programmer
Feb 20, 2001
23
GB
I have a database set up where each record has its own name "RecordName" what I need to do is use a text field to allow them to search through the databse using a text field which is at the moment simply replacing the current Record Name. I'm using a Dataenvironment to connect to the SQL database if that helps. Anyone got any simple solutions?
 
I have no idea what you mean, so I'll ask a few questions:

Is "RecordName" the name of a table in your database?
Is "RecordName" the name of a column in a table in your database?
What is the text field? What datatype is it defined as?
"a Dataenvironment" doesn't seem to identify a particular client product; what do you mean by "a Dataenvironment"?
Robert Bradley
Got extra money lying around? Visit:
 
"Test" is the name of the database, "TblRecord" is the name of the Table and "RecordName" is the name of a column in that table. The Data Environment is refering to the Microsoft Data Environment Instance 1.0 you use it to connect to Data Source, its in the Project menu below "Add Web Class..." The Text field is a basic TextBox.
 
what I need to do is use a text field to allow them to search through the databse using a text field which is at the moment simply replacing the current Record Name

Sorry to be dense about this, but I'm still unsure of what you are trying to do. If you want to search the RecordName column for all records that contain the text Fred, you could use this:

[tt]select * from tblRecord where RecordName like '%Fred%'[/tt]

I hope this helps. Robert Bradley
Got extra money lying around? Visit:
 
I'm writing all this in VB6, and was hoping to use an SQL statement within VB to search through my Database. The "RecordName" TextBox is used at run-time to search for a specific record name. "RecordName" is the primary key in the table, so once they search through and a record is found it displays the information contained in that record in other text boxes on the form. For example the user would type "Fred" in the "RecordName" TextBox, and then if a record is found it displays "txtMemberName"; "txtMemberAge"; "txtMemberAddress" all of which correspond to a column name in the database. My problem is although using your code helped me search the database I've not worked out how to bring up the information once found into the corresponding fields.
 
It sounds like you are using an ADO recordset technique (of which I am not an expert). Browse through the ASP programming or VB forums at Tek-Tips, and I think you may find existing threads that may help.

Or perhaps someone here is good at ADO and has some sample code they can post. Robert Bradley
Got extra money lying around? Visit:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top