title: C# Error: “Fill: SelectCommand.Connection property has not been initialized.” just in on pc
body: <p>This is my code:</p>
  
  <pre><code>  SqlDataAdapter adapter = new SqlDataAdapter(query, conn);
  </code></pre>
  
  <p>This program is working on <em>all other pc's</em> except for the one I've got, where I'm getting this error:</p>
  
  <pre><code>  System.InvalidOperationException: Fill: SelectCommand.Connection property has not been initialized.
  
      at System.Data.Common.DbDataAdapter.GetConnection3(DbDataAdapter adapter, IDbCommand command, String method)
      at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
      at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
      at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
      at service_managment.V.Fill_data_set(String query)
      at service_managment.V.get_first_of_tabel(String query)
      at service_managment.login.button1_Click(Object sender, EventArgs e)
      at service_managment.login.tbx_password_KeyDown(Object sender, KeyEventArgs e)
      at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
      at System.Windows.Forms.Control.ProcessKeyEventArgs(Message&amp; m)
      at System.Windows.Forms.Control.ProcessKeyMessage(Message&amp; m)
      at System.Windows.Forms.Control.WmKeyChar(Message&amp; m)
      at System.Windows.Forms.Control.WndProc(Message&amp; m)
      at System.Windows.Forms.TextBoxBase.WndProc(Message&amp; m)
      at System.Windows.Forms.TextBox.WndProc(Message&amp; m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  </code></pre>
  
  <p>How can I fix it?</p>