473,396 Members | 1,917 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,396 software developers and data experts.

Prevent duplicate data entry in Access using VB.NET?

Hello guys,

I am reading a downloaded textfile which has a fields like date,NAV and Name using VB.NET. The date on which the textfile is downloaded remains the same.After each readline operation it looks into the Access DB (tablename:Details) and updates the 3 columns(Date,NAV,Name).My question is how do i prevent the user accesing the already downloaded file or in other words how do i prevent my DB being loaded with duplicate values in VB.NET. Can anyone tell me how to go about it?
Aug 5 '08 #1
1 4987
janders468
112 Expert 100+
If I understand your question correctly you upload from a file which may or may not contain old information and you want to ensure that you don't reload information you already have.

You could do this with vb.net but I would probably use the database to enforce this as it can do so much more efficiently. That being said you will probably have to load the text file into a staging table which doesn't care about duplicates, then load the non duplicated table with the stage table data doing an outer join on the fields that make the table unique and only loading where the NonDupe_tbl values are null. Assume you have two tables Stage_tbl and NonDupe_tbl the sql would be as follows:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO NonDupe_tbl ( [Date], NAV, Name )
  2. SELECT Stage_tbl.Date, Stage_tbl.NAV, Stage_tbl.Name
  3. FROM Stage_tbl LEFT JOIN NonDupe_tbl ON (Stage_tbl.Name = NonDupe_tbl.Name) AND (Stage_tbl.NAV = NonDupe_tbl.NAV) AND (Stage_tbl.Date = NonDupe_tbl.Date)
  4. WHERE (((NonDupe_tbl.Date) Is Null) AND ((NonDupe_tbl.NAV) Is Null) AND ((NonDupe_tbl.Name) Is Null));
  5.  
  6.  
You can run the queries from vb but the database enforces the rules, which will be more efficient and probably less error prone.
Aug 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pablo | last post by:
Hello, there, I have a table tblData which has pharmacy data. The table has following fields: ClaimNum, LineNum... The ClaimNum has claim number which is 12 characters. LineNum is NULL. The...
14
by: Ed Jay | last post by:
On a multi-textbox form, linked to an external js, I use onBlur to call: function chkNum(cellname) { var str = document.getElementById(cellname).value.toString(10); if (str < 28 || str > 36)...
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). ...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
2
by: eazyone | last post by:
I can prevent a duplicate ID from being entered, but can't figure out how to go to that specific record. I keep getting an error message on: Me.Bookmark = rsc.Bookmark Its not opening and...
6
by: teser3 | last post by:
I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries? I only have 3 fields in the insert in the action page: CODE <?php $c=OCILogon("scott", "tiger",...
1
by: chicago1985 | last post by:
I have a unique constraint in my Oracle table for 3 fields. If I enter duplicate info on the table using Oracle client I will get an Ora message error ORA-00001 that tells me it is a duplicate entry...
4
by: jbrumbau | last post by:
Hello, I have been successfully using a database I've created for several months to populate an equipment list for a project we've been working on. However, the form has recently stopped working...
4
by: AXESMI59 | last post by:
have a project in which I am entering Serial Numbers and Date codes into a Combo box. Serial numbers are all different. However, they could each have the same Date Code. Each Serial Number has a...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.