i have try to display record on labels if name exist in table and open popup page.
if typed name is exist in textbox in table than popup will open after than display record on label of that restricted person
i have done this but when i try to display record on label than occur error "Column 'ADDRESS' does not belong to table"
Below i have tried code whats wrong kindly help.
string namestring = txtitemname.Text.Trim();
//string namestring = txtfname.Text + " " + txtlname.Text;
if (txtitemname.Text != "")
{
SqlConnection con = new SqlConnection(this.con);
con.Open();
SqlCommand cmd = new SqlCommand("Select USERNAME From USERDATA where USERNAME Like '" + namestring + "'", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
if (dt.Rows.Count > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal();", true);
lblName.Text = dt.Rows[0]["USERNAME"].ToString();
lblAddress.Text = dt.Rows[0]["ADDRESS"].ToString();
lblCityvillage.Text = dt.Rows[0]["MONO"].ToString();
lblTaluka.Text = dt.Rows[0]["DESIGNATION"].ToString();
con.Close();
}