How to save user information during create user in Custom Membership Provider?


So i Inherits the  System.Web.Security.MembershipProvider, and i got a lot of  methods and propertys. one of them is CreateUser

1     Public Overrides Function CreateUser(ByVal username As String, ByVal password As String, ByVal email As String, ByVal passwordQuestion As String, ByVal passwordAnswer As String, ByVal isApproved As Boolean, ByVal providerUserKey As Object, ByRef status As System.Web.Security.MembershipCreateStatus) As System.Web.Security.MembershipUser
2 3 4 Dim ConnString As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=|DataDirectory|Nwind2003(Good).mdb" 5 Dim sqlstring As String = "INSERT INTO userss (username, password, Email, passwordQuestion , passwordAnswer)VALUES (?,?,?,?,?)" 6 Dim conn As New OleDbConnection(ConnString)
7 Dim cmd As New OleDbCommand(sqlstring, conn)
8 cmd.CommandType = CommandType.Text
9 10 cmd.Parameters.AddWithValue("username", username)
11 cmd.Parameters.AddWithValue("password", password)
12 cmd.Parameters.AddWithValue("email", email)
13 cmd.Parameters.AddWithValue("passwordQuestion", passwordQuestion)
14 cmd.Parameters.AddWithValue("passwordAnswer", passwordAnswer)
15 16 conn.Open()
17 cmd.ExecuteNonQuery()
18 conn.Close()
20 Return Nothing
21 End Function

but from some reason its not working. and there is error

Server Error in '/Application1' Application.

 Syntax Error in INSERT INTO.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Syntax Error in INSERT INTO

my table is "userss"  and the Fields are:

Username (key) Text 8
Password Text 8
Email Text 50
passwordQuestion Text 50
passwordAnswer Text 50

 i sew someh Articles  but they was not help me.

8/16/2008 5:32:06 AM 27051 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 20

I am not access user, but will the "?, ?, ?" something values in the VALUES part of the INSERT statement would cause some confusion on execution?

Patrick Oliveros
Web Developer - Emerson Electric Asia, Ltd. - ROHQ
8/16/2008 7:11:00 AM

 flowed this Article: 


8/16/2008 7:25:32 AM

Similar Artilces:

Create User Wizard, Custom MemberShip Provider, and Custom User Data
I want to use 1 step in the create user wizard to collect custom user data using a custom membership provider. I added additional fields to the default express database e.g. firstname, lastname, phone, address, etc.Customized the createuserwizard by adding additional text boxes.Created a custom membership provider and tried to override the create user method and added additional parameters. Apparently you cannot override the membership.createuser method with additional parameters as I had to brush up on overriding/overloading to finally figure this out. I'm not crazy about using the p...

Custom user information in Create User control
In my user registration form, I would like to have more fields like Company Name, Surname, Product S/N..etc.  Is it possible to do this using .NET 2.0 CreateUser Control?  If not, I should create my own form, right?  If I do this, how can I store information(username, password, email..etc) in the build-in aspnet_xxx tables as CreateUser control does? Thanks. Yes this is totally possible.  It is a little lengthy to just get into.  I can't type out a bunch of code right now, or even tonight.  I just read a chapter in this book a couple weeks ago that ...

Create user with custom membership provider
Hi! I'd like to store my users details in my already created table, that i've used earlier. In this table i need to store some more infos than username and password. But if i had my custom membership provider that implements the built in MembershipProvider, i can only use that CreateUser method defined in it. The problem is that it doesn't have enough parameters to pass my additional datas about my users. So anyone have a suggestion how to solve this case? Thanks in forward. Use the profile feature.

PasswordRecovery Control with custom membership provider and custom membership User...
i am trying to use Passwrod recovery control with custom membership provider and custom membership user.... but one thing i am not getting is that membership provider and membership user, both classes contains the GetPassword() method...i'm just stuck which method to use and how?second, Membership API doesn't expose the call to GetPassword() method.. i.e. we cant call Membership.GetPassword() from our code.... so how to call that function?and last, i need a bit of help in the working of Password recovery control.. where to put the validation logic of the userid entered in the username field?...

Create User mehod of the Custom Membership Provider
Hey guys, I m trying to use the Create User Control supplied with the .net 2.0. I've implemented my own Custom Membership Provider because I want to use my own Access database. I've also done the coding for the CreateUser method of the Custom Membership Provider, to insert the data in the Login table of my own database. But its giving me an error message like - "Syntax error in Insert into statement". I've tried a lot, but couldn't figure it out that what's wrong in that command line... N e way I post my code below: Public Overrides Function CreateUser(ByVal username As St...

Unable to retrieve all user information with custom membership Providers in web.config
Hi, I have a gripview that read all user information from default database “ASPNETDB.MDF”. My web.config contains multiple membership Providers, because in the future I would like to use the custom membership provider to control login, logout and create new user process.What happen is the GridView will not display anything with the custom membership Provider in web.config. It will work fine if I remove all of the custom membership Providers. So how do I make it work? I have no idea what’s wrong with it. Below is the code:Default.aspxProtected Sub Page_Load(ByVal sender As Object, ByVa...

custom validate user function in custom membership provider not working
I am using a custom membership provider for my website as the one supplied in 2.0 doesn't fit my needs. I know that I have to create the membership provider, set up the validateuser function and tell the webconfig that I am using a different provider. However, when I run the program, It is failing the login even though that username/password does exist in the database that I connect to. Here is the code I am using:  Public Overrides Function ValidateUser( _ ByVal username As String, _ByVal password As String _ ) _ As Boolean Dim _isValid As Boolean = FalseDim _sqlCo...

How to store user profile information during create user?
Hi, I'm just try to store user information during create user via CreateUserWizard that add Textbox, DropDownList and RadoButtonList. How to store data form control to UserProfile (via CreateUserWizard) ? Note. I set DisableCreatedUser = true because want to proof user befor activate. (Begining V2.0, VB, VWD 2005 Express Edition) Here is some example c# code that I have in the CreateUser event of the CreateWizard command.  I also do some stuff after this but I think this is the code you are interested in.     protected void CreateUserWizard1_CreatedUser(objec...

Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)
Hi when i try and open a database in sql server management studio i get the error "Cannot open user default database. Login failed. Login failed for user 'DOMAIN\User'. (.Net SqlClient Data Provider)", what can i do to rectify this, i have googled around and still havent found no answers. Which authentication mode is your Sql Server configured - MixedMode, Windows Authentication or Sql Server Authentication? Please refer to and    Ple...

How to create a new membership user and then login to the website as that user
 Hi, I want to create a user dynamically and than logging into the web site using that user.The scenario is that the web site is using ASP.NET memberhsip. I am adding the OpenID support, but I want to create a new membership user if the OpenID authentication passed and then login the site as this user. How can I do that?  Thanks! I'm not sure what OpenID is but you should be able to call System.Web.Security.Membership.CreateUser(...) and then FormsAuthentication.Authenticate()If everything happens for a reason what is the reason for this error? Hi try this: Memb...

Custom Membership Provider: Getting User
So I have my custom membership provider working for login, creation, deleting, but am lost as to what you are supposed to do with the functions to look up MembershipUser's How do you create a MembershipUser object?  what needs to be there?  is the .ProviderKey goiug to be my custom "UserID" from my existing member table (which is just an autonumber uint field)   Public Overloads Overrides Function GetUser(ByVal username As String, ByVal userIsOnline As Boolean) As System.Web.Security.MembershipUser      '''''  What goes here?End Function&q...

Creating customized create user
This is probably a very simple question but i would appreciate som help I am trying to create a customized create user page: Public Sub CreateUser_Click (sender As Object, e As EventArgs)     Try       ' Attempt to create the user      Membership.CreateUser(Username.Text, Password.Text)       Status.Text = "Created new user: " & Username.Text     Catch ex As MembershipCreateUserException       ' Display the status if an exception occurred  &nb...

Hi,I am using the membership store. When I create a new user with the CreateUserWizard there are 2 records being inserted into the aspnet_Users table. The records have different a different UserID and ApplicationID.Why would there be 2 records inserted when I'm only creating a single user?Thanks   Seems you have different applicationName attribute settings for Membership/Roles/Profiles. Check this:

Membership API and custom user information.
I'm seeking for advice how to use the Membership API with custom user information. I have created my own SqlMembershipProvider that I currently use only for validating users. I'd like to be able to use it also for adding new users and updating the information of existing users. My problem is that the parameters for CreateUser() and the properties of MembershipUser just aren't enough for me. I need to be able to save custom information like the phone number of the user. Now, I could actually create the user with CreateUser() and after that update the user's information with the cus...

Web resources about - How to save user information during create user in Custom Membership Provider? -

Information - Wikipedia, the free encyclopedia
Information (shortened as info or info. ) is that which informs, i.e. an answer to a question, as well as that from which knowledge and data ...

InformationWeek – Latest Information Technology (IT) news & IT articles - Technology news - IT magazine ...
InformationWeek provides latest Information technology (IT) news online & articles and publishes latest tech news & IT magazine for Indian IT ...

ACT anti-domestic violence boss calls for better information sharing across sector
... ACT government will seek to strike a balance between victim safety with privacy concerns as it eyes better ways of sharing information ...

Queensland weather: Latest storm warning information
PARTS of Queensland were hit by severe storms, with golf-ball-size hail in the Granite Belt Monday afternoon.

Magnetic protein may provide animals with navigation information
What do monarch butterflies, salmon, lobsters, bats, mole rats, and marine nudibranch mollusks have in common? As I'm sure you already knew, ...

Security researchers have discovered more information on how the Sony hackers managed to stay undetected ...
More details of the hack that wiped out Sony Pictures' computer systems and resulted in thousands of internal emails and documents leaking online ...

White House offers states more information on refugees
Governors are still clashing with the administration over whether to admit Syrian refugees into their states

VTech hack exposes personal information of 5 million adults and children
Another data breach? Won't someone please think of the children?

Is The Freedom Of Information Act Stifling Intellectual Freedom?
The time to be surprised about FOIA requests is over: Scientists need to be on their guard and harness this digital world for themselves.

THE NUMBER GROWS Nearly 1,000 Clinton emails had classified information
THE NUMBER GROWS Nearly 1,000 Clinton emails had classified information

Resources last updated: 12/2/2015 5:35:10 AM