Get Primary Key from Table.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I want to request if an Colum is Primary Key or Not via Ole (C# Code).
Following Part of Code descripes my ideas. However the function
returns always false, no matter what Database System (e. g. MS SQL,
Paradox, ...). This also appears if i request the Attribute
'AllowDBNull'. Now - how can I fix this?

Thanks for your help.

Stefan

Code:

public Boolean isPrimary (int checkPos)
{
OleDbDataAdapter myAdapter = new
OleDbDataAdapter(commandText, conn);
DataSet mySet = new DataSet();

myAdapter.Fill(mySet);

return mySet.Tables[0].Columns[checkPos].Unique;
}

.



Relevant Pages

  • Get Primary Keys
    ... I want to request if an Colum is Primary Key or Not via Ole. ... Following Part of Code descripes my ideas. ... This also appears if i request the Attribute ...
    (microsoft.public.win32.programmer.ole)
  • Get Primary Keys
    ... I want to request if an Colum is Primary Key or Not via Ole. ... Following Part of Code descripes my ideas. ... This also appears if i request the Attribute ...
    (microsoft.public.win32.programmer.ole)
  • Re: Get Primary Key from Table.
    ... RightHand .NET consulting & development www.rthand.com ... Blog: http://cs.rthand.com/blogs/blog_with_righthand/ ... Following Part of Code descripes my ideas. ... This also appears if i request the Attribute ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: mySQL, Best Way to Increment Records
    ... if the User Table has a UserID field as the ... Primary key should be an autoincrement field, ... "REPLACE" posssibility of MySQL. ... If a request from a client requires a certain primary field, ...
    (alt.php)
  • Re: is there an equivavlent to auto_increment in ingres ?
    ... System A drops a request for SYSTEM B to do something into a table. ... It spawns information out ... only usefulness is to act as the primary key. ... spare with the apparent multiplicity of join conditions. ...
    (comp.databases.ingres)