title: Datagridview data populating on 1 machine but not another C# (Win Forms)
body: <p>I have 2 laptops that both have visual studios. I have the exact program on both computers and the Datagridview is only populating on one of them, when its the exact code on both computers. Datagridview is getting populated from SQL Server, which is being hosted on a sever. Both computers have Visual Studio. I am not getting any errors. Not sure if the code is wrong or not, but I'm really trying to understand why it would only be working on 1 computer if its the same code.</p>
  <p>I'm trying to populate the datagridview and be able to select a date and it will only show data associated with that date.</p>
  <p>This is the code - <code>cargoBoardDate</code> is a datetime picker:</p>
  <pre><code>    private void GetCargoBoard(string command)
      {
          var calander = cargoBoardDate.Value.ToShortDateString();
  
          DataTable dt = new DataTable();
          SqlDataAdapter da;
          connection.Open();
          string sql = &quot;SELECT * FROM CargoBoard WHERE DateID LIKE @DateID&quot;;
  
          using (var cmd = new SqlCommand(sql, connection))
          {
  
              cmd.Parameters.AddWithValue(&quot;@DateID&quot;, &quot;%&quot; + calander + &quot;%&quot;);
  
              connection.Close();
              connection.Open();
  
              da = new SqlDataAdapter(cmd);
              da.Fill(dt);
              da.Dispose();
              dgvCargoBoard.DataSource = dt;
              connection.Close();
          }
  
          connection.Close();
      }
  
      private void CargoBoard_Load(object sender, EventArgs e)
      {
          GetCargoBoard(&quot;SELECT * FROM CargoBoard&quot;);
          HeaderDesign();
          hideColumn();
          RenameHeader();
          formSize();
      }
  </code></pre>
  <p>Also my connection string is being called from a class (below):</p>
  <pre><code>SqlConnection connection = new SqlConnection(Helper.conString(&quot;LoadPlanner&quot;));
  </code></pre>
  <p>I have also tried having the parameter line as such:</p>
  <pre><code>cmd.Parameters.AddWithValue(&quot;@DateID&quot;, calander);
  </code></pre>
  <p>If someone could explain to me what is going on for it to work on 1 machine but not another with the exact code and a possible solution?</p>
  <p>Thank you!</p>