ADO Find Help?
- From: "greg4168@xxxxxxxxx" <greg4168@xxxxxxxxx>
- Date: 8 Sep 2005 06:26:42 -0700
Hi, I'm new to ADO and am hoping somebody here can steer me in the
right direction.
I'm using VB6, and an SQL database. I simply want to search the
database for a record containing two key values. For example, I want
to find a record where column A = xx, and column B = yy. I'm using
..Filter to do this, and believe I have it correct. Here's my filter
statement: .Filter = ("dbcolA = '" & valueA & "' and dbcolB = '" &
valueB & "'"). The result of this statement comes out to "dbcolA =
'valueA' and dbcolB = 'valueB'"
The next part I'm doing is either adding a new record to the table, or
updating the existing record, based on the result of the filter. The
way I'm doing this is as so:
If .EOF Then
.AddNew
End If
!dbcolA = valueA
!dbcolB = valueB
.Update
.Close
.Filter = adFilterNone
So, the only difference between a new record and an updated record is
the .AddNew statement.
The result of this is that when valueB changes, a new record is added
to the table as expected, but the valueB is propogated across all
records that contain valueA. I want it to create a new record, but not
touch any of the existing records.
What am I doing wrong??
Thanks very much...
.
- Follow-Ups:
- Re: ADO Find Help?
- From: lucio_tato@xxxxxxxxxxx
- Re: ADO Find Help?
- From: Steve Byrne
- Re: ADO Find Help?
- Prev by Date: Re: Map ADO data types to SQL
- Next by Date: Re: Reading Default value of column in SQL Server
- Previous by thread: Datagrid
- Next by thread: Re: ADO Find Help?
- Index(es):
Relevant Pages
|
|