Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unique index for recordset created in memory

1 view
Skip to first unread message

wat...@hotmail.com

unread,
Apr 17, 2004, 3:47:25 AM4/17/04
to
Hi,

I try to create a recordset in memory using below code.
The problem is I can not create a unique index to prevent duplicate
Primary Key for "Field1"+"Field2".
Any ideas is welcome.


----------------------------------------------------------------------

Set rs = New ADODB.Recordset
With rs.Fields
.Append "Field1", adVarChar, 255
.Append "Field2", adVarChar, 255
.Append "Field3", adVarChar, 255
End With
rs.Open


-----------------------------------------------------------------------


HELP!

Thanks

Jeerakarn W.


George Copeland

unread,
Apr 17, 2004, 12:47:23 PM4/17/04
to
<wat...@hotmail.com> wrote in message
news:u2EY7AFJ...@TK2MSFTNGP11.phx.gbl...

> I try to create a recordset in memory using below code.
> The problem is I can not create a unique index to prevent
duplicate
> Primary Key for "Field1"+"Field2".

You could guarantee "Field1"+"Field2" to be unique if they were GUIDs. Each
guid would have to be varchar (40) and the concatenated GUID would be
varchar (80). Be sure to test for performance.


Jeerakarn W.

unread,
Apr 20, 2004, 10:40:00 PM4/20/04
to
Hi. George,
Thanks for reply. I mean, I try to use a VB Code to create a recordset
in memory not in MDB Table or MSSQL Table.
The problem is I can create recordset using code here.

Set rs = New ADODB.Recordset
With rs.Fields
.Append "Field1", adVarChar, 255
.Append "Field2", adVarChar, 255
.Append "Field3", adVarChar, 255
End With
rs.Open

But I can not using a VB code to create a unique index for this memory
recordset. Actually I can use a vb code
to check a duplicate primary key before I add some record. It will be
better and easier for my life if I can use a
MS ADO DATA Control with an Datagrid Control to input data without worry
about duplicating PK. I try to use
ADOX but it does not support at all. Again try to find some VB Code to
do this.

Help please,

Jeerakarn W.

"George Copeland" <tma...@DELETETHISmail.com> wrote in message
news:vcdgc.8591$bw4....@newssvr24.news.prodigy.com...

0 new messages