我不知道在标题中具体写什么。如果您认为它的标题不正确,我会更改它。这是问题所在。我正在将下拉列表绑定到数据集(表),我需要从其中需要名称、地址行 1、地址行 2、城市、电子邮件、国家/地区等字段......并且我想在标签上显示这些字段(值)。这是完整的代码:
public String GetSessionObject()
{
string strSession = "";
if (HttpContext.Current.Session["SessionEmail"] != null)
{
strSession = HttpContext.Current.Session["SessionEmail"].ToString();
}
return strSession;
}
public DataSet BindDropDownListToAUserAddress()
{
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);
con.Open();
string strQuery = "SELECT *, FirstName +' '+ LastName as FullName from AUserAddress where AUser_ID = (Select ID from AUser where Email='" + GetSessionObject() + "')";
SqlCommand cmd = new SqlCommand(strQuery, con);
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
da.Fill(ds, "AUserAddress");
con.Close();
return ds;
}
ddlName.DataSource = objBindDDL.BindDropDownListToAUserAddress().Tables["AUserAddress"];
ddlName.DataTextField = "FullName";
ddlName.DataBind();
lblDisplayAddressLine1.Text = objBindDDL.BindDropDownListToAUserAddress().Tables["AUserAddress"].Columns.("AddressLine1").ToString();-----------????
这就是我卡住的地方。我需要来自特定列的值才能显示在特定标签上。我有什么选择?请指导....