I am trying to figure out how to set multiple text boxes/labels with one sql query.
I dont need help connecting to the database or anything like that I just need to know how I can write one query to and set multiple text boxes with that one query.
here is what I have been doing, and there has got to be an easier way.
string selectAddress = "select cust_address from customers where customer_id = " + customerID; string selectCity = "select customer_city from customer where customer_id = " + customerID; SqlCommand cmdAddress = new SqlCommand(selectAddress, con); SqlCommand cmdCity = new SqlCommand(selectCity, con); this.lblAddress1.Text = cmdAddress.ExecuteScalar().ToString(); this.lblCity.Text = cmdCity.ExecuteScalar().ToString();
I would like to be able to write one query (actually just put it in a procedure) and set the text boxes/labels to the results of the query.
Thanks in advance for any help!