String sqlconn = "User ID=sa;pwd=qq;Data Source=.;Initial Catalog=shaosjm;Provider=SQLOLEDB.1;Trusted_Connection=no ";
OleDbConnection myConnection = new OleDbConnection(sqlconn);
myConnection.Open();
string sql = "select * from users where riqi=(select max(riqi) from users) ";
OleDbCommand myCommand = new OleDbCommand(sql, myConnection);
OleDbDataReader my=myCommand.ExecuteReader();
if(my.Read())
{Session[ "na "]=my[ "name "];}
else
{Response.Redirect( "Login.aspx ");}
我想在用 <%=Session[ "na "]%> 在前面输出结果。
为什么不能用 <%=my[ "name "]%> 输出结果。不想用session和cookie。
请问怎么解决????????
------解决方案--------------------------------------------------------
这么处理吧
在aspx页
<asp:Literal ID= "Test1 " runat= "server "> </asp:Literal>
你的CS页
if(my.Read())
Test1.Text=my[ "name "].toString();
else