I am trying to extend the registration page (using this tutorial ) to add more fields to a separate database.
I am using Oracle and but the code below uses MS SQL hence sqlDataSource...
Can anyone help me traslate this into oracle? I really don't understand what's going on here. Looks like its inserting a 'UserId' but in which table??
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { TextBox UserNameTextBox = (TextBox)CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName"); SqlDataSource DataSource = (SqlDataSource)CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo"); MembershipUser User = Membership.GetUser(UserNameTextBox.Text); object UserGUID = User.ProviderUserKey; DataSource.InsertParameters.Add("UserId", UserGUID.ToString()); DataSource.Insert(); }
The way I usually insert items into Oracle using ASP.net is this way (below) but the above code don't look anything like it.
DataTable dt = new DataTable(); using (OracleConnection con = new OracleConnection(connectionString)) { OracleCommand cmd = new OracleCommand(); string sql = "INSERT INTO UserAddresses (UserId) VALUES (:UserId)"; cmd.Parameters.AddWithValue("userid", uselbl.text); cmd.Connection = con; cmd.CommandText = sql; con.Open(); try { cmd.ExecuteNonQuery(); ErrorMessage.Text = "Successful!"; } catch (Exception ex) { throw new Exception(ex.Message); } }