Я проверяю свои знания ADO.NET и SQL, и в настоящее время просто пытаюсь изучить основы. Я хочу читать данные из таблицы, и когда пользователь нажимает кнопку, появляется окно сообщения со значением в столбце ApplicationName.
В настоящее время он ничего не делает, когда я нажимаю кнопку ... есть идеи?
protected void TestSubmit_ServerClick(object sender, EventArgs e) { // Initialize the database connector. SqlConnection connectSQL = new SqlConnection(); // Send the connection string. connectSQL.ConnectionString = @"Data Source = localhost\SQLEXPRESS;" + "Initial Catalog = Inputs; Integrated Security = SSPI"; try { // Setup our command. SqlCommand theCommand = new SqlCommand("SELECT * FROM Inputs", connectSQL); // Write the stored value in the text boxes. connectSQL.Open(); SqlDataReader theReader; theReader = theCommand.ExecuteReader(); theReader.Read(); MessageBox(theReader["ApplicationName"].ToString()); theReader.Close(); connectSQL.Close(); } catch (Exception ee) { MessageBox("Oopsie: " + ee); } private void MessageBox(string msg) { Label lbl = new Label(); lbl.Text = "" + Environment.NewLine + "window.alert('" + msg + "')"; Page.Controls.Add(lbl); }