-
database field search
i am building an arabic to english dictionary in vb6, using an access database,
with different fields for verbs, nouns etc, and i want to create a search
to look for a specified word in a specified field. the desired field will
be selected from a combobox. does anyone know what code i'll need to implement
the search?
ta v much
mary
xxxxxxxxxxxxxxxxxxxx
-
Re: database field search
Mary,
One of the easiest search methods is the SELECT statement. Check your
MSDN help files under SELECT statements and you will find samples and
examples on how to implement those types of queries.
--
Sincerely,
Todd B - CEO - Agendum Software
http://www.AgendumSoftware.com | Mailto:ToddB@AgendumSoftware.com
New version AgMapthat Project Browser + released! Soon to announce five
(5) new products!
Visit our web site for more information on the new product releases!
(608) 837-6736 Voice (419) 821-9599 Fax
----------------------------------------------------------------------------
--------------------
"Mary" <redfox1043@yahoo.com> wrote in message
news:3ad86416$1@news.devx.com...
>
> i am building an arabic to english dictionary in vb6, using an access
database,
> with different fields for verbs, nouns etc, and i want to create a search
> to look for a specified word in a specified field. the desired field will
> be selected from a combobox. does anyone know what code i'll need to
implement
> the search?
>
> ta v much
>
> mary
> xxxxxxxxxxxxxxxxxxxx
-
Re: database field search
If the combobox has the actual field name, and an associated text box has
the word you are searching for, it would be something like:
Dim strCommand as string
Dim rstResults as New ADODB.Resultset
Dim conConnection as New ADODB.Connection
' Code to make the connection
conConnection.Open ...
' Get the result
strCommand = "Select * from table where " & cboField.text & " = '" & txtField.text
& "'"
rstResults.Open strCommand, conConnection, adOpenDynamic, adLockOptimistic,
adCmdText
' Get the Results
txtResults.text = rstResults!ArabicWord
If the combobox does not have the actual field name, you would need to use
some sort of substitution, such as putting an ID in the ItemData property
that refers to an array element for each combobox list element:
Dim aFieldNames(3)
cboField.Clear
cboField.AddItem "Verb"
aFieldNames(0) = "VerbField"
' etc...
' Then:
strCommand = "Select * from table where " & aFieldNames(cboFields.ItemData(cboFields.ListIndex))
& " = '" & txtField.text & "'"
"Todd B - Agendum Software" <ToddB_NOSPAM@AgendumSoftware.com> wrote:
>Mary,
>
>One of the easiest search methods is the SELECT statement. Check your
>MSDN help files under SELECT statements and you will find samples and
>examples on how to implement those types of queries.
>
>--
>Sincerely,
>
>Todd B - CEO - Agendum Software
>http://www.AgendumSoftware.com | Mailto:ToddB@AgendumSoftware.com
>
>New version AgMapthat Project Browser + released! Soon to announce five
>(5) new products!
>Visit our web site for more information on the new product releases!
>
>(608) 837-6736 Voice (419) 821-9599 Fax
>----------------------------------------------------------------------------
>--------------------
>
>"Mary" <redfox1043@yahoo.com> wrote in message
>news:3ad86416$1@news.devx.com...
>>
>> i am building an arabic to english dictionary in vb6, using an access
>database,
>> with different fields for verbs, nouns etc, and i want to create a search
>> to look for a specified word in a specified field. the desired field will
>> be selected from a combobox. does anyone know what code i'll need to
>implement
>> the search?
>>
>> ta v much
>>
>> mary
>> xxxxxxxxxxxxxxxxxxxx
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|