469,963 Members | 1,651 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Prevent entering data into DB twice

mg
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.
Nov 18 '05 #1
3 2235
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.

<mg@theworld.com> wrote in message
news:09**********************************@microsof t.com...
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.
Nov 18 '05 #2
Or if you are using SQL, you can set fields to not have duplicates.
<mg@theworld.com> wrote in message
news:09**********************************@microsof t.com...
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.
Nov 18 '05 #3
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:e4*************@tk2msftngp13.phx.gbl...
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.

<mg@theworld.com> wrote in message
news:09**********************************@microsof t.com...
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.

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by mg | last post: by
reply views Thread by mmazid | last post: by
2 posts views Thread by AjitGoel | last post: by
3 posts views Thread by GarryJones | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.