0

ユーザーが登録時にアップロードしたプロフィール写真を表示できません。イメージのパスはデータベースに保存され、イメージはディレクトリ /data/ に保存されます。imageURL が機能しません。コードは次のとおりです: (.cs)

protected void Page_Load(object sender, EventArgs e)
{
    string us = (string)Session["userid"];
    if (!Page.IsPostBack)
    {     
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cc"].ConnectionString);
        SqlCommand cmd = new SqlCommand("select imgpath from reg where userid='" + us + "'", con);
        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            Image1.ImageUrl = dr[0].ToString();
        }
        con.Close();
    }
} 
4

0 に答える 0