如何使用代码检查此................. [英] how to use the code Check this.................

查看:51
本文介绍了如何使用代码检查此.................的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发注册和登录页面以及用户详细信息页面,当我登录用户在注册时显示在用户详细信息页面上的图像时,我想要的图像

MyDatabase表是[User]

我的数据库表是User
ID int
电子邮件主键varchar(250)
密码varchar(250)
名称varchar(250)
国家varchar(250)


说明varchar(50)
ImageName varchar(1000)

登录页面代码是这个

I develop register and loginpage and userDetails page I want when I login image that user upload when he/she register display on userdetails page

MyDatabase Table is [User]

MY database table is User
ID int
Email primarykey varchar(250)
Password varchar(250)
Name varchar(250)
Country varchar(250)


Description varchar(50)
ImageName varchar(1000)

login page code is this

SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\omar\Documents\Visual Studio 2005\WebSites\WebSite8\App_Data\Database.mdf;Integrated Security=True;User Instance=True");
    con.Open();
        string mycmd="Select * from [User]where Email='"+TextBox1.Text+"'AND Password='"+TextBox2.Text+"'";
        

        SqlDataAdapter da=new SqlDataAdapter(mycmd,con);
        DataSet ds = new DataSet();
        da.Fill(ds,"MyDataSet");
        int RowCount=ds.Tables[0].Rows.Count;
        if(RowCount==0)
        {
          Response.Write("<script language='javascript'>alert( 'Invalid password or Email ' )</script>");
        
        }

else{
Session["ID"]=ds.Tables[0].Rows[0].ItemArray[0];
Response.Redirect("UserDetails.aspx");
   
        }


如何在page_load事件中使用以下代码来显示我无法理解的图像.
什么语法或page_load事件中的确切语法是使用此行代码显示以下图像的确切语法或方法?


How use below code in page_load event to display image I can not understand.
What syntax or exact in page_load event what exact syntax or way to use this line of code to display image given below?

string MyQueryStr = "SELECT * FROM USER WHERE ID=" +
            Session["ID"].ToString();





Response.ContentType = "image/gif";
MyPicture.ImageUrl = Convert.ToString(ds.Tables[0].Rows[0].ItemArray[7]);

推荐答案

签出此页面;
code-for-retrieving-the-image-from- sqldatabase [ ^ ]
它不起作用的原因是您无法在
中设置图像 < asp:图片ID ="Image1" runat =服务器"/>
因为它需要图片网址而不是图片对象.
Check this page out ;
code-for-retrieving-the-image-from-sqldatabase[^]
the reason it does not work is you cant set the image in the
<asp:Image ID="Image1" runat="server" />
because it needs image url not the image object.


这篇关于如何使用代码检查此.................的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆