通过 TSQL 填充 aspnet_Profile 表
我正在尝试通过 TSQL 从 CSV 文件或数据库源批量加载 aspnet 成员。我对任何其他选项(即网络应用程序或 ssis 包)感到满意。
我面临的问题是每个成员都有自己的个人资料,如下所示:
- 名字
- 姓氏
- 手机
- 公司地址...等
看起来 aspnet 配置文件存储为
属性名称和属性值
后端 aspnet_profile 表中的
。谁能建议我如何将员工数据及其个人资料加载到 aspnet 会员数据库中?
谢谢。
I'm trying to bulk load the aspnet members via TSQL from CSV File or Database sources. I'm happy with any other options i.e. net application or ssis packages.
The problem I'm facing is that each members have a their own profile as blow:
- First Name
- Last Name
- Mobile
- Company Add .... etc.
Looks like aspnet profile is stored as
PropertyNames and PropertyValues
in backend aspnet_profile table.
Could anyone please suggest me how I can load the employee data and their profile on to aspnet membership database?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,假设您的问题是如何正确表示配置文件值,那么它实际上是如何存储在数据库中的:
aspnet_Profile.PropertyNames 包含配置文件变量名称、相应的存储描述符和值长度,如下所示:
[变量名称]:[存储]:[开始]:[长度]:[变量名称] ...
其中
示例:Test1:S:0:10:Test2:B:0:100 :Test3:S:10:5:TestDate:S:15:95
aspnet_Profile.ProfileValuesString 包含一一连接的配置文件值,没有分隔符或其他任何内容。要生成此列值,您实际上不必测量值的长度。要从那里阅读,您显然必须这样做。
注意:当序列化为 PropertyValuesString 时,DateTime 值将被包装到 XML 中。
示例:TestStringABCDE <日期时间>2011-07-29T10:00:28.1603073+04:00
aspnet_Profile.ProfileValuesBinary 与前一个几乎相同。除非它是二进制的
所以,话虽这么说,您的场景是将 csv 数据放入数据库中的临时表中,然后在其上运行脚本以生成 PropertyNames (这里最复杂的部分)和 PropertyValuesString (最简单的部分)。就是这样。
Well, assuming your problem is how to represent profile values correctly, here's how it's actually being stored in DB:
aspnet_Profile.PropertyNames contains profile variable names, corresponding storage descriptor and value length as follows:
[VariableName]:[Storage]:[Start]:[Length]:[VariableName] ...
where
Example: Test1:S:0:10:Test2:B:0:100:Test3:S:10:5:TestDate:S:15:95
aspnet_Profile.ProfileValuesString contains profile values concatened one by one with no delimiters or anything else. To generate this column value you don't actually have to measure lenghts of values. To read from there you obviously have to.
Note: DateTime values are being wrapped into XML when serialized to PropertyValuesString.
Example: TestStringABCDE<?xml version="1.0" encoding="utf-16"?> <dateTime>2011-07-29T10:00:28.1603073+04:00</dateTime>
aspnet_Profile.ProfileValuesBinary is pretty much the same as previous one. Except it's binary
So, having that said, your scenaro would be to get your csv data into a temp table in DB, then run a script over it to generate PropertyNames (most complex part here) and PropertyValuesString (easiest part). That's it.