Mondeo Posted December 13, 2006 Posted December 13, 2006 I want to use membership on my website and i've setup a role called members. I've set the database up on an SQL 2000 server using the tool. I have a windows application with 2000 member accounts on, these are also stored on SQL 2000. I want to go through this database and automatically add the members so they have matching accounts on the website in the members role. How do I do it, what I mean is what entries do I need to make in the membership database(s). Thanks Quote
Administrators PlausiblyDamp Posted December 13, 2006 Administrators Posted December 13, 2006 If you already have an exisiting database containing all the accounts it might be easier to just use it as it is rather than converting it to the format expected by ASP.Net 2.0 - you would need to create your own providers though. Specifically you would need to create a membership provider and a role provider; http://msdn2.microsoft.com/en-us/asp.net/aa336558.aspx is the offical MS toolkit for this (including the source code to the built in providers). http://www.codeplex.com/Wiki/View.aspx?ProjectName=AltairisWebProviders may be worth a look as it contains a simple example of what you are after plus associated documentation. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
tfowler Posted December 14, 2006 Posted December 14, 2006 I agree with PD. You wouldn't want to have to maintain those 2000 accounts on two different servers...that would be a nightmare! Quote
Mondeo Posted December 19, 2006 Author Posted December 19, 2006 Thanks, there will be no interaction between the two sets of data though, once I have imported them then thats it. It will be better for me to use the built in providers, and a lot quicker. I have read that theres a stored procedure for creating users, how do you use it? Quote
tfowler Posted December 19, 2006 Posted December 19, 2006 I have read that theres a stored procedure for creating users' date=' how do you use it?[/quote'] Well, if you are using the SqlMembershipProvider, you simply call the CreateUser method (http://msdn2.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.createuser.aspx). I have never used the stored procedure in the database directly. You would probably use it like any other stored procedure: Dim con As New SqlConnection("your connection string") Dim com As New SqlCommand("EXEC <name of the stored procedure>", con) com.Parameters.AddWithValue("<parameter1 name>", parameter1_value) : : con.Open() com.ExecuteNonQuery() con.Close() or something like that. That's just off the top of my head with no help from Intellisense, or anything like that, but it should give you the idea. Todd Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.