title: How to get columns Primary key constraints using SqlConnection.GetSchema()
body: <p>I have some code of ADO.NET to dynamically detect the database schema, what I need is how to get unique columns constraints and Primary key constraints using the <code>GetSchema</code> method on <code>SqlConnection</code>.  This is the code that I have:</p>
  
  <pre><code>conn.Open();     
  SqlCommand mSqlCommand = new SqlCommand("sp_pkeys", conn);
  mSqlCommand.CommandType = CommandType.StoredProcedure;
  mSqlCommand.Parameters.Add(
      "@table_name", SqlDbType.NVarChar).Value = tableName;
  SqlDataReader mReader = mSqlCommand.ExecuteReader(
      (CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly));
  //ExecuteReader();
  DataTable schema = mReader.GetSchemaTable();
  mReader.Close();
  conn.Close();
  </code></pre>