dataset has no primary key

  • Thread starter Thread starter Geraldine Hobley
  • Start date Start date
G

Geraldine Hobley

Hello,
I have a problem where by I have built a dataset
using a stored procedure that matches on more than one
table. However when I try to update the dataset by first
obtaining a datarow from it, I get the error message table
does not have a primary key. Is there any way of setting a
primary key on my dataset dsprojects, or is it just a fact
that you can't update a dataset based on a query matching
more than one table.

Dim DrCurrentProj As DataRow
DrCurrentProj = dsProjects.Tables
("Project").Rows.Find(IntProjectId)

thanx in advance

Geraldine
 
Hi,

You have to add it manually. The key can be based on more than one
column. Here is an example.

dsClient.Tables(0).PrimaryKey = New DataColumn()
{dsClient.Tables(0).Columns("ID")}

Ken
 
Back
Top