Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Prevent entering data into DB twice

Reply
Thread Tools

Prevent entering data into DB twice

 
 
=?Utf-8?B?bWdAdGhld29ybGQuY29t?=
Guest
Posts: n/a
 
      06-09-2004
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.
 
Reply With Quote
 
 
 
 
ASP.Confused
Guest
Posts: n/a
 
      06-09-2004
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.



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
 
ASP.Confused
Guest
Posts: n/a
 
      06-09-2004
Or if you are using SQL, you can set fields to not have duplicates.


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
ASP.Confused
Guest
Posts: n/a
 
      06-09-2004
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:(E-Mail Removed)...
> 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.
>
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent from entering some bad websites after searching Mike Computer Support 11 04-10-2009 11:54 PM
Trailing commas when entering data into SQL using ASP Techhead ASP General 3 02-09-2009 09:33 PM
Dynamically loading JS into iFrames - preventing IE7 popups whenleaving/entering secure connection bizt Javascript 1 05-29-2008 07:26 PM
Entering data into Excel, in specific iterated rows/columns reed.adam@gmail.com Ruby 9 08-11-2006 04:53 AM
Prevent user from entering punctuation PW HTML 10 06-18-2006 01:10 PM



Advertisments