Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Lock Controls or Record for Add/Edit/Delete C#

Lock Controls or Record for Add/Edit/Delete C#

Scheduled Pinned Locked Moved C#
csharpdatabasequestionmysqlvisual-studio
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahmed_one
    wrote on last edited by
    #1

    Dear All, I am using Visual Studio 2010 ultimate, C# language and MySql as backend database. I've a Voucher Form, which is Master Detail. After user enters voucher data, he save the data in database by clicking save button. Now I need to add a post button, which when click perform a update to Voucher record and mark it as POSTED. This is not an issue as it simply required an Sql update statement. What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user. What is the best way to do it? Are programmers do it by setting readonly property of controls true/false? Or there are other options available? Any ideas/suggestions/samples much appreciated. Best regards Ahmed

    K 1 Reply Last reply
    0
    • A ahmed_one

      Dear All, I am using Visual Studio 2010 ultimate, C# language and MySql as backend database. I've a Voucher Form, which is Master Detail. After user enters voucher data, he save the data in database by clicking save button. Now I need to add a post button, which when click perform a update to Voucher record and mark it as POSTED. This is not an issue as it simply required an Sql update statement. What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user. What is the best way to do it? Are programmers do it by setting readonly property of controls true/false? Or there are other options available? Any ideas/suggestions/samples much appreciated. Best regards Ahmed

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      ahmed_one wrote:

      What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user.

      Can this be clarified a little please? There are a few different potential problems here. First off, what do you mean by "no one can edit the record"? The database admin is going to be able to edit the record, one way or another. If you mean users should not be able to edit the record, then you are in control of what they do in the application, so you must have enabled the ability to updated? I don't know why searching alters the record (as your comment seems to suggest) - this sounds like something is very wonky to me, or you don't mean database record. It might be better to expand on your question.

      ahmed_one wrote:

      Are programmers do it by setting readonly property of controls true/false? Or there are other options available?

      Yes, it is possible and normal to do this (normally a check-box). The other options depend on what you need so no-one can answer that for you, you might want to consult the people you are writing the software for.

      PB 369,783 wrote:

      I just find him very unlikeable, and I think the way he looks like a prettier version of his Mum is very disturbing.[^]

      A 1 Reply Last reply
      0
      • K Keith Barrow

        ahmed_one wrote:

        What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user.

        Can this be clarified a little please? There are a few different potential problems here. First off, what do you mean by "no one can edit the record"? The database admin is going to be able to edit the record, one way or another. If you mean users should not be able to edit the record, then you are in control of what they do in the application, so you must have enabled the ability to updated? I don't know why searching alters the record (as your comment seems to suggest) - this sounds like something is very wonky to me, or you don't mean database record. It might be better to expand on your question.

        ahmed_one wrote:

        Are programmers do it by setting readonly property of controls true/false? Or there are other options available?

        Yes, it is possible and normal to do this (normally a check-box). The other options depend on what you need so no-one can answer that for you, you might want to consult the people you are writing the software for.

        PB 369,783 wrote:

        I just find him very unlikeable, and I think the way he looks like a prettier version of his Mum is very disturbing.[^]

        A Offline
        A Offline
        ahmed_one
        wrote on last edited by
        #3

        Keith Barrow wrote:

        ahmed_one wrote:

        What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user.

        Can this be clarified a little please? There are a few different potential problems here. First off, what do you mean by "no one can edit the record"? The database admin is going to be able to edit the record, one way or another. If you mean users should not be able to edit the record, then you are in control of what they do in the application, so you must have enabled the ability to updated? I don't know why searching alters the record (as your comment seems to suggest) - this sounds like something is very wonky to me, or you don't mean database record. It might be better to expand on your question.

        By "No one can edit the record" I mean users. Database admin surely can alter the data. That's not a problem. At present, searching is not altering the record, my requirement is: when POSTED is marked users are restricted to Add/Edit/Delete/Update that POSTED record. This means when user use find function to display record (which is POSTED now) in Winforms, it should be locked for ADD/EDIT/DELETE/UPDATE.

        K 1 Reply Last reply
        0
        • A ahmed_one

          Keith Barrow wrote:

          ahmed_one wrote:

          What I need is a way, that after POSTED is marked, no one can edit the record, even when it is search by any user.

          Can this be clarified a little please? There are a few different potential problems here. First off, what do you mean by "no one can edit the record"? The database admin is going to be able to edit the record, one way or another. If you mean users should not be able to edit the record, then you are in control of what they do in the application, so you must have enabled the ability to updated? I don't know why searching alters the record (as your comment seems to suggest) - this sounds like something is very wonky to me, or you don't mean database record. It might be better to expand on your question.

          By "No one can edit the record" I mean users. Database admin surely can alter the data. That's not a problem. At present, searching is not altering the record, my requirement is: when POSTED is marked users are restricted to Add/Edit/Delete/Update that POSTED record. This means when user use find function to display record (which is POSTED now) in Winforms, it should be locked for ADD/EDIT/DELETE/UPDATE.

          K Offline
          K Offline
          Keith Barrow
          wrote on last edited by
          #4

          It's been a long time since I've done any winforms, but in principal I'd:

          • Extract the UI that allows viewing/adding/updating the record as a control.
          • Set the control from above's enabled state to false - this will disable the control
          • Show/hide buttons in the control as appropriate

          Another option is to create two controls - one for add/edit the other for view only and display the relevant one. Depending on what you are doing, you can usually improve the user experience, though at the cost of extra work, so you need to balance these off with eachother.

          PB 369,783 wrote:

          I just find him very unlikeable, and I think the way he looks like a prettier version of his Mum is very disturbing.[^]

          A 1 Reply Last reply
          0
          • K Keith Barrow

            It's been a long time since I've done any winforms, but in principal I'd:

            • Extract the UI that allows viewing/adding/updating the record as a control.
            • Set the control from above's enabled state to false - this will disable the control
            • Show/hide buttons in the control as appropriate

            Another option is to create two controls - one for add/edit the other for view only and display the relevant one. Depending on what you are doing, you can usually improve the user experience, though at the cost of extra work, so you need to balance these off with eachother.

            PB 369,783 wrote:

            I just find him very unlikeable, and I think the way he looks like a prettier version of his Mum is very disturbing.[^]

            A Offline
            A Offline
            ahmed_one
            wrote on last edited by
            #5

            Thanks for your reply, Are there any option available via Sql, when user find the record, the find function should call a function which fetch data from MySql Db in read-only mode.

            L 1 Reply Last reply
            0
            • A ahmed_one

              Thanks for your reply, Are there any option available via Sql, when user find the record, the find function should call a function which fetch data from MySql Db in read-only mode.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              ahmed_one wrote:

              Are there any option available via Sql, when user find the record, the find function should call a function which fetch data from MySql Db in read-only mode.

              If you only "SELECT" data it will always be readonly. Simply don't update the data. No, MySQL has no magic functions.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

              A 1 Reply Last reply
              0
              • L Lost User

                ahmed_one wrote:

                Are there any option available via Sql, when user find the record, the find function should call a function which fetch data from MySql Db in read-only mode.

                If you only "SELECT" data it will always be readonly. Simply don't update the data. No, MySQL has no magic functions.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                A Offline
                A Offline
                ahmed_one
                wrote on last edited by
                #7

                Thanks....I will try this...

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups