用SQL语句从aspnet_profile表里取用户的Profile值
The aspnet_Profile table contains the following fields: UserId, PropertyNames, PropertyValuesString, PropertyValuesBinary, and LastUpdatedDate. The PropertyNames field contains a string delimited with colons (:) that identify which profile fields are stored, what their datatype is and their offset and length.
For Example:
FirstName:S:1:7:PostalCode:S:8:5:Street:S:13:15:LastName:S:28:7:
Actual values stored in PropertyValuesString:
Viktar 601481336 Finley rd Karpach
ASP.Net profiles can store binary data as well, but usually your are interested in string data such as First and Last names. First lets create helper function, which helps to get position:length pair values:
CREATE FUNCTION dbo.fn_GetElement
(
@ord AS INT,
@str AS VARCHAR(8000),
@delim AS VARCHAR(1) )
RETURNS INT
AS
BEGIN
-- If input is invalid, return null.
IF @str IS NULL
OR LEN(@str) = 0
OR @ord IS NULL
OR @ord < 1
-- @ord > [is the] expression that calculates the number of elements.
OR @ord > LEN(@str) - LEN(REPLACE(@str, @delim, '')) + 1
RETURN NULL
DECLARE @pos AS INT, @curord AS INT
SELECT @pos = 1, @curord = 1
-- Find next element's start position and increment index.
WHILE @curord < @ord
SELECT
@pos = CHARINDEX(@delim, @str, @pos) + 1,
@curord = @curord + 1
RETURN
CAST(SUBSTRING(@str, @pos, CHARINDEX(@delim, @str + @delim, @pos) - @pos) AS INT)
END
And then code for the actual worker function:
CREATE FUNCTION dbo.fn_GetProfileElement
(
@fieldName AS NVARCHAR(100),
@fields AS NVARCHAR(4000),
@values AS NVARCHAR(4000))
RETURNS NVARCHAR(4000)
AS
BEGIN
-- If input is invalid, return null.
IF @fieldName IS NULL
&nb
相关文档:
Repeater在前台使用比较灵活自由,但有一个问题就是Repeater不支持直接分页,这个很多人看起来就有点不想用了,但我想大家都知道GridView控件或DataGrid控件在启用自带分页的时候其实效率是非常低的,大的不说,一但到了百万级数据以后,就会感觉是多么的痛苦和无耐了,所以即使是用DataGrid(GridView)控件,高手们还是只会 ......
【AUTOTRACE】SQL优化的重要工具--AUTOTRACE
提到SQL优化,不能不提AUTOTRACE的强大功能。使用起来非常便捷,不过在是使用之前,需要做一些配置的工作。简要的描述一下这个过程,供没有使用过的朋友参考。
1.使用sys用户执行plustrce脚本
sys@ora10g> @?/sqlplus/admin/plustrce
sys@ora10g> drop role plustrace ......
As a response for customer's question, I decided to write about using Like Operator in Linq to SQL queries.
Starting from a simple query from Northwind Database;
var query = from c in ctx.Customers
where c.City == "London"
&nbs ......
查询通知是在 Microsoft SQL Server 2005 中以及 ADO.NET 2.0 的 System.Data.SqlClient 命名空间中引入的。查询通知建立在 Service Broker 基础结构的基础上,使应用程序可以在数据更改时收到通知。如果应用程序提供数据库中信息的缓存(例如 Web 应用程序),需要在源数据更改时接收通知,此功能特别有用。
通过三种方式 ......
在 Oracle 10g 中
可以通过 http://localhost:5560/isqlplus 访问 isqlplus
在 isqlplus 中 可以执行 plsql
set serveroutput on size 100000 // 打开 服务器的输出 on 后面是 缓存的大小 范围是 (2000 至 1000000)
begin
dbms_output.put_line('hel ......