There are two tables, one contains data about the experiment, information about the selected keyboard is added to another (the Nklav field of type number is either 1 or 2). In the form with the results, each experiment has a textbox in which I enter the data on the keyboard selected in this experiment, this is how I do it
SqlConnection ThisConnection = new SqlConnection(@"Data Source=STAS-ПК \SQLSERVER2014;Initial Catalog= SMSensomotorica2db; User ID=sa;Password= novell"); ThisConnection.Open(); SqlCommand thisCommand = ThisConnection.CreateCommand(); thisCommand.CommandText = "SELECT top 1 Nklav FROM nomerKlava ORDER BY ind desc"; SqlDataReader thisReader = thisCommand.ExecuteReader(); string res = string.Empty; while (thisReader.Read()) { res += thisReader["Nklav"]; } thisReader.Close(); ThisConnection.Close(); textBox1.Text = res; however, every time I perform a new experiment, it is the last selected keyboard that is displayed in all the results. How to add a parameter with an experiment ID to the query?
(id_exp = @curr_id_exp) 