title: Enable multi user management in c#
body: <p>In the table <strong>users</strong> a MySql db for each user can be stored with a different color, for example:</p>
  
  <pre><code>Users       colors
  Foo         green
  Pluto       yellow
  Foo         red
  </code></pre>
  
  <p>When the user is authenticated I need to know what color is associated with the user who logs on.</p>
  
  <p>I used the List method to append the variable color for each user in this way:</p>
  
  <pre><code>List&lt;string&gt; colorList = new List&lt;string&gt;();
  
  ....
  
  if (reader.HasRows)
  {
      while (reader.Read())
      {
          Colors = reader["Colors"].ToString();
          colorList.Add(Colors.ToString());
      }
  
          ns = string.Join(", ", colorList.ToArray());
  }
  </code></pre>
  
  <p>And everything works up here.</p>
  
  <p>Now I need publish in a <strong>GridView</strong> all rows stored in <strong>Experience table</strong> where are stored the comments of all users for each color.</p>
  
  <p>For example in the case of <strong>user Foo</strong> I need publish in <strong>GridView</strong> all comments stored in <strong>Experience table</strong> speaking of the <strong>colors red and green</strong>.</p>
  
  <p>But I can't publish this <strong>GridView</strong> because if user is <strong>Foo</strong> I see only the comments on the <strong>red color</strong> and nothing comment for <strong>green color</strong>.</p>
  
  <p>Thought with loop I have this output:</p>
  
  <pre><code>SELECT * FROM Experience WHERE Colors IN ('red');
  
  SELECT * FROM Experience WHERE Colors IN ('green');
  </code></pre>
  
  <p>My code below.</p>
  
  <p>Anybody know how can I resolve do this?</p>
  
  <p>Can you suggest?</p>
  
  <p>Can you help me?</p>
  
  <p>Thank you in advance.</p>
  
  <pre><code>private DataSet RetrieveColors()
      {
          str = null;
          strArr = null;
          count = 0;
  
          str = ns == null ? "" : ns.ToString();
          char[] splitchar = { ',' };
  
          if (!string.IsNullOrEmpty(str))
          {
              strArr = str.Split(splitchar);
          }
          else
          {
              strArr = null;
          }
  
          for (count = 0; count &lt;= strArr.Length - 1; count++)
          {
                  sql = @" SELECT * FROM Experience WHERE Colors IN (?); ";
          }
  
  
          DataSet dsColors = new DataSet();
  
          using (OdbcConnection cn =
            new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString))
          {
              cn.Open();
  
              using (OdbcCommand cmd = new OdbcCommand(sql, cn))
              {
                  for (count = 0; count &lt;= strArr.Length - 1; count++)
                  {
                      cmd.Parameters.AddWithValue("param1", Server.UrlDecode(strArr[count].Trim()));
                  }
  
                  OdbcDataAdapter adapter = new OdbcDataAdapter(cmd);
                  adapter.Fill(dsColors);
              }
          }
  
          return dsColors;
      }
  </code></pre>
  
  <p><strong>Edit # 1</strong></p>
  
  <pre><code>Users       colors
  Foo         green
  Pluto       yellow
  Foo         red
  </code></pre>