mysql - Update Row in Table on Database for Each New User WebMatrix -


i have table (about_user) in database (startersite) supposed work each seperate row each seperate user. however, no matter user signed in, have access same row (in other words new rows aren't being created each new user). have triple checked make sure in database set correctly. using startersite template registration page (edited question):

// if information valid, create new account     if (validation.isvalid()) {         // insert new user database         var db = database.open("startersite");          // check if user exists         var user = db.querysingle("select email userprofile lower(email) = lower(@0)", email);         if (user == null) {             // insert email profile table             db.execute("insert userprofile (email) values (@0)", email);              // create , associate new entry in membership database.             // if successful, continue processing request             try {                 bool requireemailconfirmation = !webmail.smtpserver.isempty();                 var token = websecurity.createaccount(email, password, requireemailconfirmation);                 if (requireemailconfirmation) {                     var hosturl = request.url.getcomponents(uricomponents.schemeandserver, uriformat.unescaped);                     var confirmationurl = hosturl + virtualpathutility.toabsolute("~/account/confirm?confirmationcode=" + httputility.urlencode(token));                      webmail.send(                         to: email,                         subject: "please confirm account",                         body: "your confirmation code is: " + token + ". visit <a href=\"" + confirmationurl + "\">" + confirmationurl + "</a> activate account."                     );                 }                  if (requireemailconfirmation) {                     // thank user registering , let them know email on way                     response.redirect("~/account/thanks");                 } else {                     // navigate homepage , exit                     websecurity.login(email, password);                      response.redirect("~/");                 }             } catch (system.web.security.membershipcreateuserexception e) {                 modelstate.addformerror(e.message);             }         } else {             // user exists             modelstate.addformerror("email address in use.");         }     } 

the table have id column (should) autoincrement.

the other columns form collects different information user 'about me' page , therefore should different each person.

how can accomplish this?

there things in question don't understand. first of code doesn't edited (it same template row 39 row 82). second, question has mysql tag: if using mysql database instead of sql ce database of starter site template, maybe problem (look @ websecurity.createaccount fails mysql).

with default startesite sql ce database answer question quite simple. add following row

db.execute("insert about_user(userid, userpage) values (@0, @1)",      db.getlastinsertid(), userpage); 

just after db.execute("insert userprofile (email) values (@0)", email); statement.

there no need of id autoincrement column in about_user table, of userid primary key column foreing key.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -