如何将sql查询结果存储到会话变量中 [英] how to store sql query result into session variable
本文介绍了如何将sql查询结果存储到会话变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在sp
SELECT [Login_Id]
,[User_Name]
,[Password]
,[Role_Id]
FROM [dbo].[Login]
Where [User_Name] =@User_Name
and [Password] =@Password
现在我想在aspx页面上将用户ID和角色ID保存到会话变量中我该怎么做?
推荐答案
如果您不知道如何做一些基本的事情,那么从谷歌开始。在这种情况下,它在这里非常快速地引导: http://msdn.microsoft.com/en-us/library /ms178581.aspx [ ^ ]解释整个过程。
If you don't know how to do something basic, then start with google. In this case it leads very quickly here: http://msdn.microsoft.com/en-us/library/ms178581.aspx[^] which explains the whole process.
在ADO.NET
对象的帮助下执行此查询。
在这些对象的帮助下将结果绑定到任何变量或DataTable
,然后存储在 Session 中或直接将这些值存储在 Session中。
您可以轻松获得有关如何处理ADO.NET
对象的示例,执行查询并获取值。
Execute this query with the help ofADO.NET
objects.
With the help of these objects bind results to any variable orDataTable
, then store in Session or directly store those values in Session.
You can easily get examples on how to deal withADO.NET
objects, execute queries and fetch the values.
这篇关于如何将sql查询结果存储到会话变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文