RoleProvider.GetAllRoles メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > RoleProvider.GetAllRoles メソッドの意味・解説 

RoleProvider.GetAllRoles メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

構成済みapplicationNameすべてのロールリスト取得します

名前空間: System.Web.Security
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説
使用例使用例

GetAllRoles メソッド実装サンプル次のコード例示します

Public Overrides Function
 GetAllRoles() As String() 
  Dim tmpRoleNames As String
 = ""

  Dim conn As OdbcConnection = New
 OdbcConnection(connectionString)
  Dim cmd As OdbcCommand = New
 OdbcCommand("SELECT Rolename FROM [" & rolesTable
 & "]" & _
                                           " WHERE ApplicationName
 = ?", conn)

  cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar,
 255).Value = ApplicationName

  Dim reader As OdbcDataReader = Nothing

  Try
    conn.Open()

    reader = cmd.ExecuteReader()

    Do While reader.Read()
      tmpRoleNames &= reader.GetString(0) & ","
    Loop
  Catch e As OdbcException
    ' Handle exception.
  Finally
    If Not reader Is Nothing
 Then reader.Close() 
    conn.Close()      
  End Try

  If tmpRoleNames.Length > 0 Then
    ' Remove trailing comma.
    tmpRoleNames = tmpRoleNames.Substring(0, tmpRoleNames.Length - 1)
    Return tmpRoleNames.Split(CChar(","))
  End If

  Return New String() {}
End Function
public override string[] GetAllRoles()
{
  string tmpRoleNames = "";

  OdbcConnection conn = new OdbcConnection(connectionString);
  OdbcCommand cmd = new OdbcCommand("SELECT Rolename FROM
 [" + rolesTable + "]"  +
                                    " WHERE ApplicationName = ?", conn);

  cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value =
 ApplicationName;

  OdbcDataReader reader = null;

  try
  {
    conn.Open();

    reader = cmd.ExecuteReader();

    while (reader.Read())
    {
      tmpRoleNames += reader.GetString(0) + ",";
    }
  }
  catch (OdbcException)
  {
    // Handle exception.
  }
  finally
  {
    if (reader != null) { reader.Close(); }
    conn.Close();      
  }

  if (tmpRoleNames.Length > 0)
  {
    // Remove trailing comma.
    tmpRoleNames = tmpRoleNames.Substring(0, tmpRoleNames.Length - 1);
    return tmpRoleNames.Split(',');
  }

  return new string[0];
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からRoleProvider.GetAllRoles メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からRoleProvider.GetAllRoles メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からRoleProvider.GetAllRoles メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RoleProvider.GetAllRoles メソッド」の関連用語

RoleProvider.GetAllRoles メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RoleProvider.GetAllRoles メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS