[英]How to pass the result of a query to another page in c#.net razor
lets say i have this code .. 可以说我有这个代码..
@{
if (isPost){
cmd.CommandText="select * from tablename where id = @id and name = @name";
cmd.Parameters.Add(new SqlParameter("@id", Request["id"]);
cmd.Parameters.Add(new SqlParameter("@name", Request ["name"]);
myConnection.Open();
SqlDataReader reader;
reader = cmd.ExecuteReader();
myConnection.Close();
}
}
<form method="post">
<input type ="text" name="id">
<input type ="text" name="name">
<input type ="submit">
</form>
how can i send the result of the query to another page so i can view them and let the user choose one of them ? 如何将查询结果发送到另一页,以便查看它们并让用户选择其中一个?
I would save the results as an array into a session variable. 我会将结果作为数组保存到会话变量中。
Check this out, should be helpful ASP Session Object 检查一下,对ASP Session对象应该有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.