Hi Brian,
I looked at a couple of books I have on my shelf and figured this out, but
thank you.
Unfortunately, I do want to write it back to the backend, and, as luck would
have it, this does me absolutely no good! (as your caveat suggested). But
thanks for responding.
Bernie
"Brian Swanson" <(E-Mail Removed)> wrote in message
news:%238$(E-Mail Removed)...
> One other note...
>
> When adding the primary key in this way the system doesn't automatically
> set the column you assign to the primary key as unique. You have to do
> this as well by using:
>
> ldt.Columns("ColumnName").Unique = True
>
>
> ---
> Brian Swanson
>
>
> "Brian Swanson" <(E-Mail Removed)> wrote in message
> news
(E-Mail Removed):
>> I assume you are asking to add a primary key just for processing while
>> the dataset/datatable is in memory and aren't trying to write it back
>> out anywhere.
>>
>> You can add a primary key by using the PrimaryKey property on a
>> DataTable
>>
>> You can use the following code as an example:
>>
>> Dim lds as DataSet = GetSomeDataSet()
>>
>> For Each ldt As DataTable In lds.Tables
>> ldt.PrimaryKey = New DataColumn() {ldt.Columns("ColumnName")}
>> Next
>>
>> -------
>>
>> A couple things to note here. This iterates through each datatable
>> that's returned in the dataset, you can run the line inside the
>> for..each by itself if you only want to create a PrimaryKey for just one
>>
>> table.
>>
>> Also, if you want to make a multi-column primary key then the line
>> inside the for..each would look something like this:
>>
>> ldt.PrimaryKey = New DataColumn() _
>> {ldt.Columns("ColumnName1"), ldt.Columns("ColumnName2")}
>>
>> Hopefully this makes sense...
>>
>> Brian Swanson
>>
>> > > I am working with vfp free tables - there are no primary keys in the
>> > > original tables and they can't be added to the backend (because they
>> > > are
>