Cześć,
mam problem.. chciałbym odczytać wartość z konkretnej tabeli i konkretnej komórki robie to na zasadzie mouse doubleclick z datagridview -> chciałbym wyświetlić konkretną komórke w texbox1
mój kod. Może ktoś coś doradzi..
int ile = dgvpacjent.SelectedRows.Count;
if (ile > 0)
{
string numery = "";
for (int i = 0; i < ile; i++)
numery += dgvpacjent.SelectedRows[i].Cells[0].Value.ToString() + ",";
numery = numery.TrimEnd(',');
string connstring = String.Format("Server=localhost;Port=5432;User Id=postgres;Password=postgres;Database=postgres;");
NpgsqlConnection conn = new NpgsqlConnection(connstring);
conn.Open();
string sql = "SELECT * FROM pacjent WHERE numer IN( " + numery + ")";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn);
ds.Reset();
da.Fill(ds);
dt = ds.Tables[9];
textBox1.Text = dt.ToString();
conn.Close();
problem poojawia się tutaj
dt = ds.Tables[9];
t_obserwacje.Text = dt.ToString();
wyskakuje mi, że nie ma tabeli nr 9.. coś porypałem..