If i understand you well...
The quickest way is to use
Linq[
^]:
var qry = from DataGridViewRow dgvr in DataGridView1.SelectedRows
select dgvr;
DataGridView2.DataSource = qry;
Note: not tested! Just an idea.
Second solution is here:
How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control[
^]. You need to loop through the collection of selected rows and using StringBuilder class build comma separated list of ids. Finally, you need to pass this as a CommandText:
StringBuilder sb = new StringBuilder();
sb.Append(dataGridView1.SelectedCells[i].Value.ToString());
command.CommandText = String.Concat("SELECT id, muayine_adi, sabit_qiymet FROM tibbi_xidmetler WHERE id IN (", sb.ToString(),")");
Note: before you use second solution, i need to warn you about
SQL Injection[
^].