Board index » cppbuilder » Basic fetch record question

Basic fetch record question


2006-07-22 10:09:39 AM
cppbuilder75
I have a database of phone numbers and names like this:
phone VARCHAR(10);
name VARCHAR(20);
I want to be able to enter a phone number and check the database for a match
and if found, display the name. If a match is not found, then a name can be
entered and a new record will be added.
The problem is I am using TDBEdit controls on the form which display the
current value of the data fields to which they are linked. How can I blank
the DBEdit control out and allow it to accept the phone number which I will
be searching on.
If phone number is the primary key then I can do it by calling SetKey() then
EditKey() on the ClientDataSet and ReadOnly = false on the phone TDBEdit.
But what if the phone number is not the primary key and I want to use
Locate() instead to find the matching phone number ?
In advance,
Thank you,
Curt
 
 

Re:Basic fetch record question

ok, no answer to this question. Well, how about a little feedback regarding
it. Have I posted in the wrong group. Is the question too basic ? I tried
Googling to get an answer and couldn't find any sources where this exact
problem is discussed. I'm reading usage of datasets and providers and each
day find some clue which helps me to solve the problem but I am afraid that
the in-depth knowledge required will take me a month or so.
"crhras" < XXXX@XXXXX.COM >wrote in message
Quote
I have a database of phone numbers and names like this:

phone VARCHAR(10);
name VARCHAR(20);

I want to be able to enter a phone number and check the database for a
match and if found, display the name. If a match is not found, then a
name can be entered and a new record will be added.

The problem is I am using TDBEdit controls on the form which display the
current value of the data fields to which they are linked. How can I
blank the DBEdit control out and allow it to accept the phone number which
I will be searching on.

If phone number is the primary key then I can do it by calling SetKey()
then EditKey() on the ClientDataSet and ReadOnly = false on the phone
TDBEdit. But what if the phone number is not the primary key and I want to
use Locate() instead to find the matching phone number ?

In advance,
Thank you,
Curt



 

Re:Basic fetch record question

Why do not you use ADO with CursorLocation = clClient without ClientDataSet?
TDBLookupCombobox may be what you need.
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"crhras" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях следующе?
Quote

ok, no answer to this question. Well, how about a little feedback
regarding it. Have I posted in the wrong group. Is the question too
basic ? I tried Googling to get an answer and couldn't find any sources
where this exact problem is discussed. I'm reading usage of datasets and
providers and each day find some clue which helps me to solve the problem
but I am afraid that the in-depth knowledge required will take me a month
or so.



"crhras" < XXXX@XXXXX.COM >wrote in message
news:44c188e0$ XXXX@XXXXX.COM ...
>I have a database of phone numbers and names like this:
>
>phone VARCHAR(10);
>name VARCHAR(20);
>
>I want to be able to enter a phone number and check the database for a
>match and if found, display the name. If a match is not found, then a
>name can be entered and a new record will be added.
>
>The problem is I am using TDBEdit controls on the form which display the
>current value of the data fields to which they are linked. How can I
>blank the DBEdit control out and allow it to accept the phone number
>which I will be searching on.
>
>If phone number is the primary key then I can do it by calling SetKey()
>then EditKey() on the ClientDataSet and ReadOnly = false on the phone
>TDBEdit. But what if the phone number is not the primary key and I want
>to use Locate() instead to find the matching phone number ?
>
>In advance,
>Thank you,
>Curt
>
>
>


 

{smallsort}

Re:Basic fetch record question

There might be 100,000 records in this database and I don't think a
LookupComboBox would be good for that, would it ? Also, I'm not even sure
of how to implement the solution you are talking about so I think I need to
do some extensive reading on the subject.
Thanks for your response !
"Viatcheslav V. Vassiliev" < XXXX@XXXXX.COM >wrote in message
Quote
Why do not you use ADO with CursorLocation = clClient without
ClientDataSet? TDBLookupCombobox may be what you need.

//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"crhras" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях следующе?
news:44c5176d$ XXXX@XXXXX.COM ...
>
>ok, no answer to this question. Well, how about a little feedback
>regarding it. Have I posted in the wrong group. Is the question too
>basic ? I tried Googling to get an answer and couldn't find any sources
>where this exact problem is discussed. I'm reading usage of datasets and
>providers and each day find some clue which helps me to solve the problem
>but I am afraid that the in-depth knowledge required will take me a month
>or so.
>
>
>
>"crhras" < XXXX@XXXXX.COM >wrote in message
>news:44c188e0$ XXXX@XXXXX.COM ...
>>I have a database of phone numbers and names like this:
>>
>>phone VARCHAR(10);
>>name VARCHAR(20);
>>
>>I want to be able to enter a phone number and check the database for a
>>match and if found, display the name. If a match is not found, then a
>>name can be entered and a new record will be added.
>>
>>The problem is I am using TDBEdit controls on the form which display the
>>current value of the data fields to which they are linked. How can I
>>blank the DBEdit control out and allow it to accept the phone number
>>which I will be searching on.
>>
>>If phone number is the primary key then I can do it by calling SetKey()
>>then EditKey() on the ClientDataSet and ReadOnly = false on the phone
>>TDBEdit. But what if the phone number is not the primary key and I want
>>to use Locate() instead to find the matching phone number ?
>>
>>In advance,
>>Thank you,
>>Curt
>>
>>
>>
>
>


 

Re:Basic fetch record question

Does not ClientDataSet fetchs all rows into memory cache? For 100,000
records it would be better to restrict number of returned records with
WHERE.
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"crhras" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях следующе?
Quote

There might be 100,000 records in this database and I don't think a
LookupComboBox would be good for that, would it ? Also, I'm not even sure
of how to implement the solution you are talking about so I think I need
to do some extensive reading on the subject.

Thanks for your response !



"Viatcheslav V. Vassiliev" < XXXX@XXXXX.COM >wrote in message
news:44c6702d$ XXXX@XXXXX.COM ...
>Why do not you use ADO with CursorLocation = clClient without
>ClientDataSet? TDBLookupCombobox may be what you need.
>
>//------------------------------------------
>Regards,
>Vassiliev V. V.
>www.managed-vcl.com - using .Net objects in Delphi for Win32 +
>ADO.Net
>www.oledbdirect.com - The fastest way to access MS SQL Server,
>MS Jet (Access) and Interbase (through OLEDB)
>
>
>"crhras" < XXXX@XXXXX.COM >сообщи?сообщила ?новостях следующе?
>news:44c5176d$ XXXX@XXXXX.COM ...
>>
>>ok, no answer to this question. Well, how about a little feedback
>>regarding it. Have I posted in the wrong group. Is the question too
>>basic ? I tried Googling to get an answer and couldn't find any sources
>>where this exact problem is discussed. I'm reading usage of datasets
>>and providers and each day find some clue which helps me to solve the
>>problem but I am afraid that the in-depth knowledge required will take
>>me a month or so.
>>
>>
>>
>>"crhras" < XXXX@XXXXX.COM >wrote in message
>>news:44c188e0$ XXXX@XXXXX.COM ...
>>>I have a database of phone numbers and names like this:
>>>
>>>phone VARCHAR(10);
>>>name VARCHAR(20);
>>>
>>>I want to be able to enter a phone number and check the database for a
>>>match and if found, display the name. If a match is not found, then a
>>>name can be entered and a new record will be added.
>>>
>>>The problem is I am using TDBEdit controls on the form which display
>>>the current value of the data fields to which they are linked. How can
>>>I blank the DBEdit control out and allow it to accept the phone number
>>>which I will be searching on.
>>>
>>>If phone number is the primary key then I can do it by calling SetKey()
>>>then EditKey() on the ClientDataSet and ReadOnly = false on the phone
>>>TDBEdit. But what if the phone number is not the primary key and I want
>>>to use Locate() instead to find the matching phone number ?
>>>
>>>In advance,
>>>Thank you,
>>>Curt
>>>
>>>
>>>
>>
>>
>
>