Jump to content

setup a primary key

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
i want to setup a primary key without using the datacolumn class, what i tryd is...
DataSet ds;
ds.Tables["Customer"].PrimaryKey = ds.Tables["Customer"].Columns["CustID"]
then i get error that i cannot implicitly convert type system.data.datacolumn[] to system.data.datacolumn

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
How about the following?
DataColumn[] pk= new DataColumn[1];
pk[0] = ds.Tables["Customer"].Columns["CustID"];
ds.Tables["Customer"].PrimaryKey = pk;


#3
Mozana

Mozana

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
thanks, i got the answer by using the missingSchemaAction i did not want use the dataColum




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users