问下下asp.net中session变量利用数据库查询的元素赋值的问题
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath("./app_data/design.mdb"));//建立数据库连接 OleDbCommand cmd = new OleDbCommand(); OleDbDataReader oledatareader; conn.Open(); cmd.Connection = conn; cmd.CommandText =
Session["username"]=oledatareader["username"].ToString();
[解决办法]
session["id"]=reader["id"].tostring()