首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

新手了哈 路过的大仙们速来拿分

2011-12-30 
新手弱弱的问了哈 路过的大仙们速来拿分表LoginuserIDuserNameuserPsw在第一页中selectuserIDfromLoginwhe

新手弱弱的问了哈 路过的大仙们速来拿分
表Login
userID
userName
userPsw

在第一页中select   userID   from   Login   where   userName=001userPsw=123后
  如何   Session   得到userID的值     这里不会写!!!
然后
Response.Write(第二页)
在第二页中显示除userID的值

多谢大虾们了

[解决办法]
public string xxx() {
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings[ "SQLCONNECTIONSTRING "]);
SqlCommand myCommand = new SqlCommand( "select userID from Login where userName=001 and userPsw=123 ", myConnection);
myConnection.Open();
string zyID=(string)myCommand.ExecuteScalar ();
myConnection.Close();
return zyID;
}

////////////////////////////////////////////////////

Session[ "strxibie "]=类名. xxx() ;


///////////////////
在第二页中直接用一个label.Text=Session[ "strxibie "].ToString();即可

热点排行