membership DB, profile DB, and role DB

I use the following code to programatically cycle through each record in an mdb database and create users with the Membership.CreateUser method.  The code also creates a profile for the same user before moving to the next record.  The membership and profile DB is on an SQL 2000 server.

  1. How can I assign all these users to the role of user in this section of code?
  2. Also any idea why only 104 out of 148 records are added to the Membership table while all 148 profiles are created?  A sample record would be:
    UserName      DIST              lotus_notes                                  title                                       internet                           voice
    John R Slim    KYE   John R Slim/KYED/06/USjobs    Deputy in Charge          111-111-51111
    Joe Smith       CAS   Joe Smith/CASD/09/USjobs       Chief Deputy                222-222-2222
  3. If I explicitly put providers in web.config for membership and profiles, does roles use the membership db on the sql server or does it try to use a DB in the app_data directory of the current web?


        Dim sql As String = "SELECT * from Interpreters "

        Dim conn As Data.OleDb.OleDbConnection = CreateConnection()
        Dim objDR As Data.OleDb.OleDbDataReader
        Dim Cmd As New Data.OleDb.OleDbCommand(sql, conn)
        objDR = Cmd.ExecuteReader()
        If objDR.HasRows Then
            Do While objDR.Read()
                With objDR
                    Dim status As MembershipCreateStatus
                    Membership.CreateUser(.Item("UserName"), "123456", .Item("internet"), "Area Code and first 3 digits of your phone", Left(Replace(.Item("voice"), "-", ""), 6), True, status)

                    Dim myProfile As ProfileCommon = CType(ProfileCommon.Create(.Item("UserName"), True), ProfileCommon)
                    myProfile.UserName = .Item("UserName")
                    myProfile.Dist = .Item("Dist")
                    myProfile.Title = .Item("Title")
                    myProfile.voice = .Item("voice")
                    myProfile.Internet = .Item("internet")
                    myProfile.lotus_notes = .Item("lotus_notes")
                End With
        End If

12/19/2006 9:03:33 PM 27051 articles. 1 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 53

How can I assign all these users to the role of user in this section of code?

Simpy by adding:

Roles.AddUserToRole(.Item("UserName"), "User");

Also any idea why only 104 out of 148 records are added to the Membership table while all 148 profiles are created?

Try to use try / catch block where user is created - maybe some users gets rejected by Membership layer because of violating some rules for creation.

If I explicitly put providers in web.config for membership and profiles, does roles use ...

I strongly suggest to specify exactly where data are stored, some example you have here:

Dejan Vesić

MCAD for .Net technologies | | Blog:
12/19/2006 11:45:20 PM

I looked at your url example.  In order to use a local database I need to have  sql server or express loaded on the host web server? Right?  This is not possible for me.  I need to connect to a SQL Server 2000 for membership and for all DBs. 

I assume you mean the Roles.AddUserToRole(.Item("UserName"), "User") goes with the Profile part of the code?

I will look up Try/Catch as I have not used it except where already written for me.



12/20/2006 2:13:13 AM

I suggest to put Roles part inside Try/Catch when creating a user - no point of adding Role if user creation failed.

You can use any database you like, assuming that connection string is good. 

Dejan Vesić

MCAD for .Net technologies | | Blog:
12/20/2006 8:39:05 AM

Similar Artilces:

Convert Existing User DB to Net .net MemberShip DB
Hey, Im looking to take my current Users DB and put those records into the new .net membership DB. I looked at the Membership Create User SP but im not sure if that sp is the only procedure that gets called when creating a user. I was wondering if any one else has had to do this and how should i go about it. I have about 100 users that i need to copy over. Thanks. This article has a bunch of links to Membership and security information in ASP.NET: For migrating 100 users over, you might just find it easiest to create a ...

Profile db vs my db
I want to make sure user can have a preferred language.First I was thinking of storing this in 1. a client cookie...but then cookies must be enabled on the client...I dont want that2. a session cookie...but the Session object is not available from the global.asax and I need to check the language on each request, so global.asax is the place for me to check...3. a profileWhen I enable a profile on my website the ASPNETDB.MDF file is created. Here all the profile data is stored...Im just wondering, wouldnt it be wiser to store all userdata in the same database?Which would probably mean I woul...

DB DB LG ML PR DB Craig Leidy wrote: > WTF!!! -- Strong Bo "Reality is merely an illusion, albeit a very persistent one." -- Albert Einstein (1879-1955) Play it again... then you'll understand. Craig Leidy wrote: > That's one of the more brain-damaged Youtube clips I've seen, yet kinda catchy! -- Bruce ...

membership db and application db collaboration
hi!i'm building an application, which will have to store others attributes about member, which are not supported with membership. So i'm curious how to make both DBs to cooperate. will i have no problem if i store the username to my DB and then compare username in membership DB with the one in my DB in order to verify user and get other data.what <would be the best practice?thanks in advance  The best way, in my opinion, would be to create a custom membership provider with the additional methods and properties.An example

DB Profile Setup of an Oracle DB
Recently, our DBA erased our testing DB and recreated it exactly as the production DB. Ever since this change I have had a problem attaching to the testing DB profile. I get the following error. ORA-00955: name is already used by an existing object. Any suggestions? Is this a PB problem or an Oracle problem? The DBA thinks that it is a PB problem. Please, send me an e-mail in addition to posting to this newsgroup. Thanks in Advance, Kevin On Mon, 15 Dec 1997 14:41:01 -0600, wrote: >Recently, our DBA erased our testing DB and recreated ...

Using membership db to lookup data in another db and bring back into a grid view (total newbie to .net)
I have the membership stuff up and running.  I've added a field to the membership table called custnmbr.  Once a user logs in, I want store his custnbmr in the session and use that to lookup data in another db. ie: Joe logs in and his custnumbr is 001, he goes to the login success page and sees his list of service calls which is: select top 10 * from svc00200 where custnmbr = 001 (the membership.custnmbr for the logged in user) I know how to do this in old ASP using session variables....but I have no idea where to even start with .Net. Many thanks You may want to store t...

How to move data from AIX db to Linux db, same DB Version
Is there an easy way to do this for an entire database? BCP is giving me problems and the database has 234 tables, 281 Stored procedures, etc etc. I need data, indexes, sp, etc. The database dump command seems to dump to binary compatibility only. Any help is greatly appreciated. This problem has been bugging me for about 3 weeks now and its about to become one of those urgent, priority one problems which management just loves. TIA, Bill BMC Sqlbacktrack has a logical dump feature which does a good job, but the sqlbacktrack license may not be cheap. Using DBSchema and b...

Access Membership Provider With Its DB and the Application DB ?!
Hi all,If I have an application that requires Relational DB and I have constructed it. And also I wanna use the membership and role management system in ASP.NET 2.0 so In my case:1 - I have an Access DB for the application2 - I have an Access DB for the membership and role management system.However, my application DB contains already tables for users and roles ... etc. But I have found that the model of the Access DB of the provider is much better I have deleted my old tables in the app DB and I want to merge the appDB and the membership provider DB alltogether in my web application .....

Problems setting up OLE DB db profile
On a new installation of PB 10, I'm setting up a Database Profile for OLE DB. Under the Installed Datbase Interface 'OLE Microsoft OLE DB', I click New to create a profile. For Provider I choose SQLOLEDB, for Data Source I choose my server, for Location I enter 'database=xxxxx' where xxxx is my database. I give it a name and save. I then click the Connect button but get the message: "The following properties have been set in the profile but are not supported by the specified OLE DB provider: Location" Any thoughts on what I may be getting thi...

User DB as audit DB
Can I create a user db (eg: myaudit) and change some attributes finding its behavior be like sybsecurity, in other words, sa_roles can not use it, just any particular user?. thank you. On 08-Oct-2010 23:34, Miguel Riano wrote: > Can I create a user db (eg: myaudit) and change some > attributes finding its behavior be like sybsecurity, in > other words, sa_roles can not use it, just any particular > user?. thank you. No, you cannot exclude sa_role: it will always be able to access the database with sa_role. Sybsecurity is special since the permission restrictions are ...

loading DB to smaller DB
I have problem in loading a dump image into a smaller DB. The scenario is: I have sybase database (DB1) of data size 900M, log size 100M. I find 200M data and 50M log is large enough for the DB. So I want to create another database (DB2) of data size 200M and 50M with same structure and data content as DB1. I have no idea on the exact structure of DB1. Dump and load is good but it only works for the same data and log size. I would like to know any procedure/method safely create DB2 with exact image as DB1, e.g. structure, index, data content, transaction log, ALL thing in DB...

Changing the ASPNET db to My own db
dear folks,  I want to add a login control and users login to my own db,instead of aspnetdb it creates when you add a login control to your page.I mean there is provider setting in website administration bubt it does not say which db to store user information.Or if you use asp_reqsql is it for all applications wide? I want to make it different for project basis.  Thanks This post helps answering what you want to do www.vikramlakhotia.comPlease mark the answer if it helped you  Y...

db 5 and db 6
if the db create by sql anywhere 5 can be opened by adapter anywhere 6 Yes. ASA7 can even read SQLAnwhere 5 files. To use some of the new features of 6 or 7 you would have to upgrade the 5 database. -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. MySybase Search Deja: "lhl" <> wrote in message > if the db create by sql anywhere 5 can be opened by adapter anywhere 6 > > ...

Local DB into ASA DB
HI Gurus, Is there any way I can convert my local ASA DB to network database, for example can I convert EASDEMODB.db into server database. I am using a local database for my application and I want to convert that DB to server DB. Thanks in Advance Vino As posted in ASE newsgroup Vino What yo want to do in not dependent on the database file, but on the engine you use. Any database can be started up in two ways: For only local connection, use dbeng?.exe (? signifies ASA version) in your start line. For network connections, use dbsrv?.exe. Bart wrote: > H...

Web resources about - membership DB, profile DB, and role DB -

The Church of Jesus Christ of Latter-day Saints membership statistics - Wikipedia, the free encyclopedia ...
Percentages of LDS members were calculated with this information. The link under the names of each country, territory, etc. corresponds to brief ...

Civility Caucus In Congress Turns To Facebook To Boost Membership
In the midst of a heated election season and record-low approval numbers for Congress, an under-the-radar congressional caucus focused on changing ...

Search Twitter - membership
... Bum @ prodigalbum 1m Nothing will consign Labour to oblivion faster than a backroom PLP coup to oust a leader chosen by the wider membership ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Membership Sites Blueprint Review - The TRUTH Exposed! - YouTube
Membership Sites Blueprint review - My FREE $1000 a day training - Hey guys its ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

Sheikh's previous ALP membership revealed
ACT Greens senate candidate Simon Sheikh has conceded he was previously a member of the Labor party before becoming a self-proclaimed independent ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

ACT Labor's union membership rule in national conference sights
The ACT is the only jurisdiction to enforce a rule which means anyone in a job where there is a union must prove union membership when they join ...

Resources last updated: 12/17/2015 9:44:46 PM