Prevent entering data into DB twice

Discussion in 'ASP .Net' started by =?Utf-8?B?bWdAdGhld29ybGQuY29t?=, Jun 9, 2004.

  1. In the click event handler of an imagebutton (WebForm), my C# code gets the values in some textboxes and insert these values into database tables

    The page reloads itself after this event and the text boxes are cleared

    The user can then repeat the process

    How can I prevent the user from inserting the original values in the textboxes more than once.
    =?Utf-8?B?bWdAdGhld29ybGQuY29t?=, Jun 9, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?bWdAdGhld29ybGQuY29t?=

    ASP.Confused Guest

    Lets say that there is a text box named tbx_name. You would use the
    following string as your query string (in VB.NET):

    Dim sql as string = "SELECT * FROM tblMyTable WHERE username='" +
    tbx_name.Text + "'"

    If the EOF flag is set, then the record doesn't exist.



    <> wrote in message
    news:...
    > In the click event handler of an imagebutton (WebForm), my C# code gets

    the values in some textboxes and insert these values into database tables.
    >
    > The page reloads itself after this event and the text boxes are cleared.
    >
    > The user can then repeat the process.
    >
    > How can I prevent the user from inserting the original values in the

    textboxes more than once.
    ASP.Confused, Jun 9, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?bWdAdGhld29ybGQuY29t?=

    ASP.Confused Guest

    Or if you are using SQL, you can set fields to not have duplicates.


    <> wrote in message
    news:...
    > In the click event handler of an imagebutton (WebForm), my C# code gets

    the values in some textboxes and insert these values into database tables.
    >
    > The page reloads itself after this event and the text boxes are cleared.
    >
    > The user can then repeat the process.
    >
    > How can I prevent the user from inserting the original values in the

    textboxes more than once.
    ASP.Confused, Jun 9, 2004
    #3
  4. =?Utf-8?B?bWdAdGhld29ybGQuY29t?=

    ASP.Confused Guest

    NOTE: the way I described how to do the SQL string works with ADO, don't
    know about ADO.NET, but I would think it would be the same.

    "ASP.Confused" <anonymous@> wrote in message
    news:...
    > Lets say that there is a text box named tbx_name. You would use the
    > following string as your query string (in VB.NET):
    >
    > Dim sql as string = "SELECT * FROM tblMyTable WHERE username='" +
    > tbx_name.Text + "'"
    >
    > If the EOF flag is set, then the record doesn't exist.
    >
    >
    >
    > <> wrote in message
    > news:...
    > > In the click event handler of an imagebutton (WebForm), my C# code gets

    > the values in some textboxes and insert these values into database tables.
    > >
    > > The page reloads itself after this event and the text boxes are cleared.
    > >
    > > The user can then repeat the process.
    > >
    > > How can I prevent the user from inserting the original values in the

    > textboxes more than once.
    >
    >
    ASP.Confused, Jun 9, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c3A=?=

    How do i restrict entering non-numeric data

    =?Utf-8?B?c3A=?=, Oct 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    556
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 27, 2004
  2. PW
    Replies:
    10
    Views:
    942
    Jonathan N. Little
    Jun 18, 2006
  3. Techhead
    Replies:
    3
    Views:
    225
    Bob Barrows
    Feb 9, 2009
  4. Replies:
    9
    Views:
    146
    Sam Smoot
    Aug 11, 2006
  5. bizt
    Replies:
    1
    Views:
    109
Loading...

Share This Page