I'm trying to check for duplicates before I do an INSERT into the
Access database table. I basically want to alert the user if the
'ProjectName' and the 'MileStones' are already in the table..
thanks
Code Below:
Private Sub btnADD_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btnADD.Click
strSQL = "INSERT INTO Project" & _
"(ProjectNa me, Planned, Actual, MileStones, Status,
[Next], Comments)VALUES " & _
"('" & txtProject.Text & "'," & _
"'" & txtPlanned.Text & "','" & txtActual.Text & "'," & _
"'" & txtMile.Text & "','" & txtStatus.Text & "'," & _
"'" & txtNext.Text & "','" & txtComment.Text & "')"
connection.Open ()
Dim cmd As New OleDbCommand(st rSQL, connection)
cmd.ExecuteNonQ uery()
connection.Clos e()
End Sub 11 5989
Richard,
One option would be to select the count of the number of rows where
projectname and milestones equal the values you are about to insert. Use
executescalar to return the count. If the count is greater than zero then you
know a row with those values already exists in the table.
I would also recommend that you use parameters to supply values to your sql
statements instead of concatenating textbox values into the sql statement.
The techinque you are using can lead to so-called sql injection attacks.
Kerry Moorman
"ri***********@ northwesternmut ual.com" wrote:
I'm trying to check for duplicates before I do an INSERT into the
Access database table. I basically want to alert the user if the
'ProjectName' and the 'MileStones' are already in the table..
thanks
Code Below:
Private Sub btnADD_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btnADD.Click
strSQL = "INSERT INTO Project" & _
"(ProjectNa me, Planned, Actual, MileStones, Status,
[Next], Comments)VALUES " & _
"('" & txtProject.Text & "'," & _
"'" & txtPlanned.Text & "','" & txtActual.Text & "'," & _
"'" & txtMile.Text & "','" & txtStatus.Text & "'," & _
"'" & txtNext.Text & "','" & txtComment.Text & "')"
connection.Open ()
Dim cmd As New OleDbCommand(st rSQL, connection)
cmd.ExecuteNonQ uery()
connection.Clos e()
End Sub
Kerry,
>
I would also recommend that you use parameters to supply values to your
sql
statements instead of concatenating textbox values into the sql statement.
The techinque you are using can lead to so-called sql injection attacks.
I am always curious how that can happen at an Access (Jet) Database, which
can not direct be connected to internet.
As this can be a problem in an Intern Lan or an DataBase direct on the own
drive, then there are for sure more important lecks to close.
Cor
Richard,
What is the part that has not to be insterted as duplicate in the database?
Cor
On Dec 9, 1:25 pm, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nl>
wrote:
Richard,
What is the part that has not to be insterted as duplicate in the database?
Cor
Actually, I wouldn't want the whole record inserted into the database
if the "ProjectNam e" and "Milestones " already exist in the Access
database.
Basically, the user enters data from a VB .Net form into the
database... they enter a "ProjectNam e", "Planned", "Milestones ",
"Status" and "Next" via textboxes. When they click the button "add" I
want to make sure that there isn't a "ProjectNam e" and "Milestones "
from another record that are the same as the oone they're trying to
enter...
thanks
On Dec 9, 2:04 pm, "richardkre...@ northwesternmut ual.com"
<richardkre...@ northwesternmut ual.comwrote:
On Dec 9, 1:25 pm, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nl>
wrote:
Richard,
What is the part that has not to be insterted as duplicate in the database?
Cor
Actually, I wouldn't want the whole record inserted into the database
if the "ProjectNam e" and "Milestones " already exist in the Access
database.
Basically, the user enters data from a VB .Net form into the
database... they enter a "ProjectNam e", "Planned", "Milestones ",
"Status" and "Next" via textboxes. When they click the button "add" I
want to make sure that there isn't a "ProjectNam e" and "Milestones "
from another record that are the same as the oone they're trying to
enter...
thanks
Actually, I wouldn't want the whole record inserted into the database
if the "ProjectNam e" and "Milestones " already exist in the Access
database.
Basically, the user enters data from a VB .Net form into the
database... they enter a "ProjectNam e", "Planned", "Milestones ",
"Status" and "Next" via textboxes. When they click the button "add" I
want to make sure that there isn't a "ProjectNam e" and "Milestones "
from another record that are the same as the oone they're trying to
enter...
thanks
Cor,
I have never understood what you mean when you say that Access databases are
not vulnerable to sql injection attacks because they cannot be directly
connected to the internet. Are you saying that Access can't be used with ASP
or ASP.Net?
At any rate, here are a couple of urls for you to look at: http://portal.spidynamics.com/blogs/...07/28/170.aspx http://www.webapptest.org/ms-access-...-sheet-EN.html
Kerry Moorman
"Cor Ligthert[MVP]" wrote:
Kerry,
I would also recommend that you use parameters to supply values to your
sql
statements instead of concatenating textbox values into the sql statement.
The techinque you are using can lead to so-called sql injection attacks.
I am always curious how that can happen at an Access (Jet) Database, which
can not direct be connected to internet.
As this can be a problem in an Intern Lan or an DataBase direct on the own
drive, then there are for sure more important lecks to close.
Cor
Be aware that the second link in this reply has a virus is spam
Cor
Kerry,
A access database can be used by ASP. or ASP.Net, however not direct by its
IP address like database servers as SQL Server can. (or its dns name on the
Lan)
Your action to an Access (Jet) database reach never the Internet you have
always something between it, what by instance can be a webservice.
By the way, in my idea the first link is SQL script injection mixing up with
hacking a database by its table, in my idea not what is SQL script
injection. (Where I here not write what that is, I am not giving help in
hacking).
Cor
Richard,
To do what you need you need first your textboxes have working.
Have a look at this tip http://www.vb-tips.com/BindingSource.aspx
Cor
<ri***********@ northwesternmut ual.comschreef in bericht
news:b3******** *************** ***********@s19 g2000prg.google groups.com...
On Dec 9, 2:04 pm, "richardkre...@ northwesternmut ual.com"
<richardkre...@ northwesternmut ual.comwrote:
>On Dec 9, 1:25 pm, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nl> wrote:
Richard,
What is the part that has not to be insterted as duplicate in the
database?
Cor
Actually, I wouldn't want the whole record inserted into the database if the "ProjectNam e" and "Milestones " already exist in the Access database.
Basically, the user enters data from a VB .Net form into the database... they enter a "ProjectNam e", "Planned", "Milestones ", "Status" and "Next" via textboxes. When they click the button "add" I want to make sure that there isn't a "ProjectNam e" and "Milestones " from another record that are the same as the oone they're trying to enter...
thanks
Actually, I wouldn't want the whole record inserted into the database
if the "ProjectNam e" and "Milestones " already exist in the Access
database.
Basically, the user enters data from a VB .Net form into the
database... they enter a "ProjectNam e", "Planned", "Milestones ",
"Status" and "Next" via textboxes. When they click the button "add" I
want to make sure that there isn't a "ProjectNam e" and "Milestones "
from another record that are the same as the oone they're trying to
enter...
thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TimG |
last post by:
I have a column that has 75 values, 50 are unique/25 are duplicates. I
need to be able to bring back a list of the duplicates, listing all
rows even if more than two have the same value. I need to be able to
do this using t-sql.
Thanks,
Tim
|
by: Mr. B |
last post by:
The following code is how I check for duplicates in a List box. This is
simple enough as there is only one column of stuff to check.
' Check for Duplicates
' Search listbox (from last to first)
For cntr = lbDwgList.Items.Count - 1 To 1 Step -1
' If next item is a duplicate -> Remove It
If lbDwgList.Items(cntr) = lbDwgList.Items(cntr - 1)...
|
by: Jared Evans |
last post by:
I developed a console application that will continually check a message
queue to watch for any incoming data that needs to be inserted into MS
SQL database.
What would be a low-cost method I could use inside this console
application to make sure the MS SQL database is operational before I
perform the insert?
|
by: Marlene |
last post by:
Hi All
I have the following scenario, where I have found all the duplicates
in a table, based on an order number and a part number (item).I might
have something like this:
Order PODate Rec Qty Invoice# Item
Supplier Status POReceivedDate
570133 03/09/2004 50 0 DMEDIUM L0010 PENDING 03/09/2004...
|
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 this line: Set rs =
db.OpenRecordset("SELECT ID FROM Contacts WHERE (" & sWhere & ");")
Contacts being the main table. I am using access 2003...
| |
by: ganeshkumar08 |
last post by:
Hi SQL friends,
I friends i need to check whether the record is already available..
ie. Before Inserting and Updating which are the validations to be done.
I need a standard solution for this.
Using SELECT and WHERE clause we can able to check for the availability, but i need a standard which are followed in the company.
Can any one...
|
by: Lester |
last post by:
I'm driving myself crazy with a problem in trying to translate a query
written for Access to that for SQL server. I would think that I would
use a trigger, but am not sure how to set it up.
We have a database that manages bookings in four banquet halls. It was
running in an Access database, but two years ago, I migrated it to SQL
server....
|
by: Pascal |
last post by:
Hello
I am trying to create a small application where the user must identify
before he begins. If it has never used the application, it identifies
creating a new user : firtsname + name + date of birth.
I created a form on which I drag and drop the table Eleves from my dataset
calcul_mentalDataSet from the database calcul_mental.mdb. As...
|
by: kylie991 |
last post by:
Hi I am stuck on checking if a 2D array has duplicates.
I have to write a function to check if a column has duplicates and then another function to check if the rows have duplicates from a file.
How would I go about this... I have the array reading a file correctly is it just the check for duplicates that I am stuck on... :)
|
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...
|
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...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |