当我在配置文件中填写userdeatils onece然后注销并再次登录时,用户配置文件为空 [英] when i fill userdeatils onece in profile then logout and log in again then user profile is empty
本文介绍了当我在配置文件中填写userdeatils onece然后注销并再次登录时,用户配置文件为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i有一个问题,当用户通过用户名和密码登录后,
他/她去他/她的个人资料并填写他们的信息
即姓名,电子邮件地址和phonenumebr
然后他登录并填写信息然后他/她退出
然后当他/她再次登录并查看他/她的个人资料然后他的个人资料是空的
protected void Button1_Click1( object sender,EventArgs e)
{
try
{
cg.updateuser(Convert.ToInt32(Session [ UserID]) ,TextBox1.Text,TextBox2.Text,TextBox3.Text);
// Label14.Text = TextBox1.Text ++ TextBox2.Text ++ TextBox3。文字;
}
catch
{
Label14.Text =( 成功更新);
}
Label1 .Text = Convert.ToString(TextBox1.Text + );
Label2.Text = Convert.ToString(TextBox2.Text + );
Label15.Text = Convert.ToString(TextBox3.Text + );
}
受保护 void Button6_Click( object sender,EventArgs e)
{
TextBox1.Visible = true ;
TextBox2.Visible = true ;
TextBox3.Visible = true ;
Label1.Visible = false ;
Label2.Visible = false ;
Label15.Visible = false ;
try
{
cg.updateuser(Convert.ToInt32(Session [ UserID]),TextBox1.Text,TextBox2.Text,TextBox3.Text);
Label14.Text = TextBox1.Text + + TextBox2.Text + + TextBox3.Text;
}
catch
{
Label14.Text =( 成功);
}
}
按钮1是编辑按钮代码和按钮6是更新代码
解决方案
嗯。您确实知道到达报告成功的点的唯一方法是 出现问题,并且操作失败,抛出异常?
尝试
{
// 某些可能有效或无效的代码
}
catch
{
// 异常时来到这里因为出现问题而被抛出。
}
hey all
i have a problem that
when user log in through theri username and password then after this
he/she go to his/her profile and fill their info
i.e FUll name ,email address and phonenumebr
then one he login adn fill info then he/she logout
then when he/she once again log in and see his/her profile then his.her profile is empty
protected void Button1_Click1(object sender, EventArgs e)
{
try
{
cg.updateuser(Convert.ToInt32(Session["UserID"]),TextBox1.Text, TextBox2.Text, TextBox3.Text);
//Label14.Text = TextBox1.Text + "" + TextBox2.Text + "" + TextBox3.Text;
}
catch
{
Label14.Text = ("Updated Succesfully");
}
Label1 .Text= Convert.ToString(TextBox1.Text + "");
Label2.Text = Convert.ToString(TextBox2.Text+"");
Label15.Text = Convert.ToString(TextBox3.Text+"");
}
protected void Button6_Click(object sender, EventArgs e)
{
TextBox1.Visible = true;
TextBox2.Visible = true;
TextBox3.Visible = true;
Label1.Visible = false;
Label2.Visible = false;
Label15.Visible = false;
try
{
cg.updateuser(Convert.ToInt32(Session["UserID"]), TextBox1.Text, TextBox2.Text, TextBox3.Text);
Label14.Text = TextBox1.Text + "" + TextBox2.Text + "" + TextBox3.Text;
}
catch
{
Label14.Text = ("Success");
}
}
button 1 is edit button code and button 6 is update code
解决方案
Um. You do realize that the only way to get to the points where you report "success" is when there has been a problem, and the operation has failed, throwing an exception?
try { // some code which may or may not work } catch { // Comes here when an exception is thrown because there was a problem. }
这篇关于当我在配置文件中填写userdeatils onece然后注销并再次登录时,用户配置文件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文