I've the next code that ought to have the ability to obtain the primary type in a table

public List<string> GetPrimaryKeysForTable(string tableName)
    {
        List<String> retVal = new List<string>();
        SqlCommand command = connector.GetCommand("sp_pkeys");
        command.CommandType = System.Data.CommandType.StoredProcedure;
        command.Parameters.AddWithValue("@table_name", typeof(SqlChars)).Value = tableName;
        SqlDataReader reader = command.ExecuteReader();
        while (reader.Read())
        {
            retVal.Add(reader[3].ToString());
        }
        return retVal;
    }

I've got a table known as Users during my database. After I pass Users in as my parameter, the readers returns no results. Any idea why this can be neglecting to return initially my secrets?

Do this rather:

command.Parameters.Add("@table_name", SqlDbType.NVarChar).Value = tableName;

It appears like you possess an problem together with your use of .AddWithValue() which might be leading to your condition. Begin to see the fix below:

public List<string> GetPrimaryKeysForTable(string tableName)
{
    List<string> retVal = new List<string>();
    SqlCommand command = connector.GetCommand("sp_pkeys");
    command.CommandType = System.Data.CommandType.StoredProcedure;
    command.Parameters.AddWithValue("@table_name", tableName);
    SqlDataReader reader = command.ExecuteReader();
    while (reader.Read())
    {
        retVal.Add(reader[3].ToString());
    }
    return retVal;
}

Inside your example you're trying to include the @table_name like a Type as opposed to a string.

Any chance it must be qualified using the schema? Something similar to:

command.Parameters.AddWithValue("@table_name", typeof(SqlChars)).Value = "dbo." + tableName;

or:

command.Parameters.AddWithValue("@schema", "dbo");

Or perhaps is there some parm you have to increase tell it the database within the server?

You can just use as below, can you please give it a try:

command.Parameters.AddWithValue("@table_name", ("dbo." + tableName));

The saved procedure 'sp_pkeys' takes three parameters:

command.Parameters.Add("@table_name", SqlDbType.NVarChar).Value = tableName;
command.Parameters.Add("@table_owner", SqlDbType.NVarChar).Value = tableOwner;
command.Parameters.Add("@table_qualifier", SqlDbType.NVarChar).Value = tableQualifier;

It really works with only @table_title but tend to try passing the 3 to ascertain if it is important.

Question: Does your table have secrets defined?

I've run the slightly modified code below against severa tables inside a test DB of my very own and delay pills work not surprisingly:

static class Program
{
    static void Main(string[] args)
    {
        var connStr = new SqlConnectionStringBuilder
        {
            DataSource = "localhost",
            InitialCatalog = "RichTest",
            IntegratedSecurity = true
        };

        using (var conn = new SqlConnection(connStr.ToString()))
        {
            conn.Open();

            var parents = GetPrimaryKeysForTable(conn, "People");

            Console.WriteLine("Parent Keys:");
            foreach (var p in parents)
            {
                Console.WriteLine("  {0}", p);
            }
        }
    }

    static IList<string> GetPrimaryKeysForTable(SqlConnection conn, string tableName)
    {
        if (conn == null) throw new ArgumentNullException("Value is null", "conn");
        if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentNullException("Value is null or emtpy", "tableName");

        List<String> retVal = new List<string>();
        using (var command = new SqlCommand
        {
            Connection = conn,
            CommandText = "sp_pkeys",
            CommandType = CommandType.StoredProcedure
        })
        {
            command.Parameters.AddWithValue("@table_name", typeof(SqlChars)).Value = tableName;
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                retVal.Add(reader["COLUMN_NAME"].ToString());
            }
        }
        return retVal;
    }

}