protected void DropDownServerName_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Database_Shared_NotebookConnectionString"].ConnectionString);
conn.Open();
string serverName = DropDownServerName.SelectedValue;
string sqlquery = ("SELECT Architecture FROM tblServer WHERE (ServerName = " + serverName + ")");
SqlCommand command = new SqlCommand(sqlquery, conn);
txtUpdateArchitecture.Text = command.ExecuteScalar().ToString();
conn.Close();
}
The DropDownServerName aready connected to SQL Server using SqlDataSource to show list of values on ServerName column.
After I get select value called "Brad" and I want value from Architecture column from Brad to show up on textbox. However I got error say, Invalid column name "Brad". The column is suppose to be ServerName and Brad is just a value in ServerName column.