Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:04:54+00:00 2026-06-11T14:04:54+00:00

i have this the code and i have this problem i am trying to

  • 0

i have this the code and i have this problem

  • i am trying to save a new user to my web site : the query is succeded but without insertion
  • ie the table “User” and the table “UserAcl” still without any modification and it is clear that the query is executed
    File User.cs:

File Compte.cs

public bool SaveUser(string identification, string acc, string mot, string notify, string nom, string phone, string mail) {
               try
               {
                   if (identification == null || acc == null || nom == null || mail == null  || mot == null) return false;
                   ITransaction transaction = User.OpenSession().BeginTransaction();
                   User u = new User() { Account = acc, Identification = identification, ContactEmail = mail, ContactName = nom, ContactPhone = phone, NotifyEmail = notify, Password = mot };
                   User.OpenSession().SaveOrUpdate(u);
                   transaction.Commit();
                  ITransaction transaction2 = User.OpenSession().BeginTransaction();
                   Useracl ua = new Useracl { Account = acc, UserID = identification, AccessLevel = 1, AclID = (Useracl.GetUseracl().Count + 1).ToString() };
                   Useracl.OpenSession().SaveOrUpdate(ua);
                   transaction2.Commit();
                   return true;
               }
               catch { return false; }

           }

File Administration.cs

  public ActionResult Index()
       {

           ViewBag.Title = c.GetUserID().Count.ToString();
            return View();
        }
        public ActionResult BeforeRegister()
        {


            return View();
        }
        public ActionResult AfterRegister(string Pseudo, string Phone, string Email, string Password, string Notify)
        {

            bool a = c.SaveUser((c.GetPassword().Count + 1).ToString(), (c.GetPassword().Count + 1).ToString(), Password, Notify, Pseudo, Phone, Email);
            if (a)
            {
                return RedirectToAction("Index", "Administration");
            }
            else

                return RedirectToAction("BeforeRegister", "Administration");

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:04:56+00:00Added an answer on June 11, 2026 at 2:04 pm

    First, you could use if (!String.IsNullOrEmpty(myString)) rather than if (myString==null).
    Also, you may want to use your sessions within a using block.

    bool ret= new bool();
    if ((!String.IsNullOrEmpty(foo1)) && (!String.IsNullOrEmpty(foo2)))
    {
    //ConnectionDB is a public class, with a static method ISessionFactory SessionFactory(), and the method OpenSession() returns an ISession 
     using (NHibernate.ISession nhSession = ConnectionDB.SessionFactory.OpenSession())
     {
     try
     {
      User u = new User();
      //set your User
      nhSession.Transaction.Begin();
      nhSession.Save(u);
      nhSession.Transaction.Commit();
      nhSession.Close();
    
      ret = true;
     }
     catch (Exception ex)
     {
     ret = false;
     }
    }
    return ret;
    

    Now, about the query not inserting, it could be a mapping problem, or maybe you’re supressing the exception elsewhere (like your static method User.OpenSession().SaveOrUpdate(u))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, but I have a problem. When I update but do
I have this simple code, using Joda-time. Works fine, but I have a problem.
Im new in this JavaScript world, but i have this problem i want to
I have this code and can't figure out what seems to be the problem:
I have a problem with a memory leak. I have this code in a
Problem Hello all! I have this code which takes my jpg image loops through
I have a cross-language problem regarding md5 :). I have this code in Java:
I have created this Fiddle with this code: This is my problem I want
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
i am a beginner and i have a problem : this code doesnt compile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.