PC Review


Reply
Thread Tools Rate Thread

assigning primary key to more than one column

 
 
gaffar
Guest
Posts: n/a
 
      6th Jan 2005
Sir,

if we want to assign a primary key to a single cloumn. below code is used.

objTable1.Keys.Append("PrimaryKey", KeyTypeEnum.adKeyPrimary,
"PrimaryKey_Field")

if i want to assign primary to more than one column then what will be code.


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      6th Jan 2005
Hi,

The datatable's primarykey accepts an array of datacolumns. Link
shows an example.

http://msdn.microsoft.com/library/de...rykeytopic.asp

Ken
------------------------
"gaffar" <(E-Mail Removed)> wrote in message
news:eX91wD%(E-Mail Removed)...
Sir,

if we want to assign a primary key to a single cloumn. below code is used.

objTable1.Keys.Append("PrimaryKey", KeyTypeEnum.adKeyPrimary,
"PrimaryKey_Field")

if i want to assign primary to more than one column then what will be code.



 
Reply With Quote
 
 
 
 
gaffar
Guest
Posts: n/a
 
      7th Jan 2005
Sir Can you help the same code in the Vb.net
"Ken Tucker [MVP]" <(E-Mail Removed)> wrote in message
news:u66cTg#(E-Mail Removed)...
> Hi,
>
> The datatable's primarykey accepts an array of datacolumns. Link
> shows an example.
>
>

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdatadatatableclassprimarykeytopic.asp
>
> Ken
> ------------------------
> "gaffar" <(E-Mail Removed)> wrote in message
> news:eX91wD%(E-Mail Removed)...
> Sir,
>
> if we want to assign a primary key to a single cloumn. below code is

used.
>
> objTable1.Keys.Append("PrimaryKey", KeyTypeEnum.adKeyPrimary,
> "PrimaryKey_Field")
>
> if i want to assign primary to more than one column then what will be

code.
>
>
>



 
Reply With Quote
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      7th Jan 2005
Hi,

Try something like this.
dsClient.Tables(0).PrimaryKey = New DataColumn()
{dsClient.Tables(0).Columns("FirstName"),
dsClient.Tables(0).Columns("LastName")}



Ken

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

"gaffar" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
Sir Can you help the same code in the Vb.net
"Ken Tucker [MVP]" <(E-Mail Removed)> wrote in message
news:u66cTg#(E-Mail Removed)...
> Hi,
>
> The datatable's primarykey accepts an array of datacolumns. Link
> shows an example.
>
>

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdatadatatableclassprimarykeytopic.asp
>
> Ken
> ------------------------
> "gaffar" <(E-Mail Removed)> wrote in message
> news:eX91wD%(E-Mail Removed)...
> Sir,
>
> if we want to assign a primary key to a single cloumn. below code is

used.
>
> objTable1.Keys.Append("PrimaryKey", KeyTypeEnum.adKeyPrimary,
> "PrimaryKey_Field")
>
> if i want to assign primary to more than one column then what will be

code.
>
>
>




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why open more than one Excel program to see more than one workbook =?Utf-8?B?c3RldmVtYWxlZQ==?= Microsoft Excel Misc 3 11th Jun 2007 03:09 PM
how to assign primary key to more than one field gaffar Microsoft ADO .NET 1 10th Jan 2005 09:14 AM
how to assign more than one primary key gaffar Microsoft Dot NET 1 10th Jan 2005 09:10 AM
how to assign primary key to more than one field gaffar Microsoft VB .NET 1 10th Jan 2005 09:03 AM
More Than One Primary Key Pam Microsoft Access Database Table Design 3 14th Aug 2003 07:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:31 AM.