I have a problem to get specify value from my query. I receive one row for my GridView but when i try to read that one value to get it into some variable it said me that there is no any value.
else if (Request.QueryString.AllKeys.Contains("a"))
{
String sql_user = "SELECT c1.ID, c1.SHORT_NAME, ao1.NAME, c1.REGON FROM (tabel1 c1 LEFT JOIN tabel2 ao1 ON c1.ID = ao1.ID WHERE c1.ID = ?";
connection.OPEN();
OleDbCommand sql_s = new OleDbCommand(sql_user, polaczenie);
sql_s.Parameters.add("?", OleDbType.Integer).Value = Request.QueryString["a"];
OleDbDataAdapter sqlDa = new OleDbDataAdapter(sql_s);
DataTable dt = new DataTable();
sqlDa.Fill(dt);
GRID_VIEW1.DataSource = dt;
GRID_VIEW1.DataBind();
OleDbDataReader customer = sql_s.ExecuteReader();
// i want to get SHORT_NAME so that one below i think dosent work
// but any way it make me an Exception of any value not found but on GridView it shows me clearly one ROW
learerLabel.Text = (String) cmd.ExecuteScalar();
connection.Close();
}
I do it in many ways like some Session or Reader but i dont remmeber my all tries now, but always it said me that there is no value in my query. What am I doing wrong? Thanks