473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2357
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: JimO | last post by:
I teach HS computers and one of my kids has a web site with a textbox of info that the user can scroll down and read. The problem is that users can also enter text into it. Is there a way, or a...
2
by: Danny | last post by:
I have a combo box look up and list items in a table, it is not bound. It works fine but how can I prevent the users from entering in there own data? i have an 'on change' event that when it...
3
by: mg | last post by:
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...
0
by: mmazid | last post by:
I would like to know how to prevent entering the same data as a primary key to an MS Access database and return with an error message confirming the data already exists in ASP.Net (VB.Net). ...
3
by: tlyczko | last post by:
Hello, I think what I'm asking for may not be possible, but I'll try anyway. I have MainForm with 3 subforms, one SubForm requires data entry, the other two don't (optional). MainForm has...
17
by: emma.sax | last post by:
Hi all, I have a form where we would like the user to input their email address twice, to ensure they've typed it correctly, as is found on most sign-ups I'm looking for a solution to the...
7
by: e_matthes | last post by:
Hello everyone, I've read enough about email validation to know that the only real validation is having a user respond to a confirmation message you've sent them. However, I want to store the...
2
by: AjitGoel | last post by:
Hi; I need to create a custom textbox control which will not allow a user to paste text from the clipboard. The user has to always type the text into the textbox. I tried searching on the...
3
by: GarryJones | last post by:
I found this handy little script on the net that means the user can only press backspace or numbers in form input. <script type="text/javascript"> function numbersonly(e){ var...
0
by: jehrich | last post by:
Hi Everyone, I am a bit of a hobby programmer (read newbie), and I have been searching for a solution to a SQL problem for a recent pet project. I discovered that there are a number of brilliant...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.