コード例 #1
0
ファイル: UserDAL.cs プロジェクト: almda/Kanban-board
        public static void saveUser(UserStruct UserDetails)
        {
            SQLiteCommand command = new SQLiteCommand();

            try
            {
                DAL.OpenConnect();
                command             = new SQLiteCommand(null, DAL.connection);
                command.CommandText = "INSERT INTO Users(UserName, Password)  " +
                                      " VALUES (@User_UserName, @User_Password)";
                SQLiteParameter UserName = new SQLiteParameter("@User_UserName", UserDetails.getUserName());
                SQLiteParameter Password = new SQLiteParameter("@User_Password", UserDetails.getPassword());
                command.Parameters.Add(UserName);
                command.Parameters.Add(Password);
                command.Prepare();
                int changes = command.ExecuteNonQuery();
                command.Dispose();
                DAL.CloseConnect();
                Logger.Log.Info("The registrtion of " + UserDetails.getUserName() + " is Succeeded");
            }
            catch (SQLiteException e)
            {
                Logger.Log.Fatal("while the saving process of " + UserDetails.getUserName() + " accord, there was an error -" + e.Message);
                command.Dispose();
                DAL.CloseConnect();
            }
        }