473,668 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2372
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.co m> wrote in message
news:09******** *************** ***********@mic rosoft.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.co m> wrote in message
news:09******** *************** ***********@mic rosoft.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.Confus ed" <anonymous@> wrote in message
news:e4******** *****@tk2msftng p13.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.co m> wrote in message
news:09******** *************** ***********@mic rosoft.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
6826
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 better control, method, to prevent user from entering text? Thanks, Jim
2
3130
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 changes, it does something else to a field based on their selection. I also have the LimitTOList on, but when they click in there, they get an error first that says the 2110-focus cannot move the focus to this control. (I have the .setfocus
3
441
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 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.
0
1632
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). Function AddFault(ByVal faultID As Integer, ByVal username As String, ByVal title As String, ByVal desc As String) As Integer Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Documents an"& _ "d...
3
3208
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 some BeforeUpdate field validation code. I would like to do the following:
17
5469
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 problem where a user (and me it has to be said) just either highlights the email address with their mouse (or Ctrl-A) and then Ctrl-C, Ctrl-P (or right-click copy, right-click paste) into the next field down.
7
3046
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 address temporarily, so I want to make sure what is entered is safe to work with. I have a basic understanding of regexps, so I could write one that checks for a simple format like: something followed by @ followed by something followed by .....
2
2275
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 internet since I guessed someone would have faced this problem before but of no avail. Do we have pointers on how I should go about doing this??
3
5283
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 unicode=e.charCode? e.charCode : e.keyCode if (unicode!=8){ //if the key isn't the backspace key (which we should allow) if (unicode<48||unicode>57) //if not a number return false //disable key press
0
1965
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 minds hanging around here, and I was hoping someone could point me in the right direction. I'm using MS SQL 2005 and I have created a table of "level changes" that basically stores the device name , the previous level and the new level along...
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8367
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.