Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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?

Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...