dataset has no primary key

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
 
K

Ken Tucker [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top