Hi everyone.
With ASP I register in DB Access rows of one file excel; this procedure works but problem: Access record double rows of file excel.
You can exclude from registration double rows ?
I attach the file excel record to access.
I register with this logic:
1) all rows;
2) where rows no data register date of today;
3) if same row with a date and the other undated eliminate row undate.
Register rows excel file number: 1, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14
Discard rows 2, 3 and 5
In the field date rows 6, 7, 8, 9, 10, 11, 12, 13, 14 record date of today. -
<!--#include virtual="/include/ConnMySQL.asp"-->
-
-
<%
-
-
Set Rs = Server.CreateObject("ADODB.Recordset")
-
Rs.Open "SELECT DISTINCT * from [Foglio1$]", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("/public/UploadFolder/Book-2.xls")&";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
-
-
Do Until Rs.Eof
-
-
if IsDate(Rs("DATA")) then
-
strData = formatDBDate(Rs("DATA"), "mysql")
-
-
strSql = "INSERT INTO Tabella (F1, F2, DataF3) VALUES ( " & Rs("f1") & ", '" & Rs("f2") & "', " & strData & ") "
-
-
else
-
strData = formatDBDate(Date(), "mysql")
-
-
strSql = "INSERT INTO Tabella (F1, F2, DataF3) VALUES ( " & Rs("f1") & ", '" & Rs("f2") & "', " & strData & ") "
-
end if
-
objconn.execute(strSql)
-
-
response.write strSQL &"<br />"
-
-
Rs.MoveNext
-
Loop
-
-
-
Rs.close()
-
set Rs = nothing
-
-
objconn.Close()
-
Set objconn = Nothing
-
-
%>
-
Help please.
Viki1967
4 2252 jhardman 3,406
Recognized Expert Specialist
Sorry, I had a hard time trying to understand what your question is. Are you still looking for a solution?
Jared
Yes, I looking for a method to ensure duplicate rows are not inserted in the table Access: -
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 333, 'CCC', '2008-03-06') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 333, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 333, 'CCC', '2008-03-11') ==> NO
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 334, 'CCC', '2008-03-06') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 334, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 335, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 336, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 337, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 338, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 339, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 340, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 341, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 342, 'CCC', '2008-03-11') ==> YES
-
INSERT INTO Tabella (F1, F2, DataF3) VALUES ( 343, 'CCC', '2008-03-11') ==> YES
-
Regards,
viki
jhardman 3,406
Recognized Expert Specialist
The easiest method I have found to not duplicate records is to search for the record I am looking for: - Query = "Select * FROM Tabella WHERE F1 = 333 AND F2 = 'CCC' AND DataF3 = '2008-03-06'"
-
objRS.open query, objConn, adOpenDynamic, adLockOptimistic
-
-
if objRS.eof then 'no matching record was found, so I need to add it
-
objRS.addNew
-
objRS("F1") = 333
-
objRS("F2") = "CCC"
-
objRS("DataF3") = "2008-03-06"
-
objRS.update
-
else 'record was found
-
response.write "This record is already in the db"
-
end if
Does this make sense?
Jared
Many thanks, I don't have it any problem: -
-
<!--#include virtual="/include/ConnMySQL.asp"-->
-
-
<%
-
-
Set Rs = Server.CreateObject("ADODB.Recordset")
-
Rs.Open "SELECT * FROM [Foglio1$]","Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("/public/UploadFolder/Book-2.xls")&";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
-
-
Do Until Rs.Eof
-
-
if IsDate(Rs("Data")) then
-
strData = formatDBDate(Rs("Data"), "mysql")
-
else
-
strData = formatDBDate(Date(), "mysql")
-
end if
-
-
Query = " SELECT * FROM Tabella WHERE F1 = " & Rs("F1") & " AND F2 = '" & Rs("F2") & "' AND DataF3 = " & strData & " "
-
Set objRS = Server.CreateObject("ADODB.Recordset")
-
objRS.open Query, objconn
-
-
response.write Query & "<br><br>"
-
-
if objRS.eof then
-
strSql = "INSERT INTO Tabella (F1, F2, DataF3) VALUES ( " & Rs("f1") & ", '" & Rs("f2") & "', " & strData & ") "
-
objconn.execute(strSql)
-
response.write strSQL &"<br />"
-
-
else
-
response.write "This record is already in the db"
-
-
end if
-
-
objRS.close()
-
set objRS = nothing
-
-
Rs.MoveNext
-
Loop
-
-
Rs.close()
-
set Rs = nothing
-
-
objconn.Close()
-
Set objconn = Nothing
-
-
%>
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Johno |
last post by:
Hi
Is there an easy way to enter lots of duplicate data in Access, like
you can in Excel by just clicking and dragging? I have various fields
that require the same data for each record and I can only find
reference to repeating whats in the previous field when trying to
duplicate data. Is there a quick way to enter the same data into a
particular field for many records?
Thanks
Johno
|
by: Arno R |
last post by:
Hi all,
I will have to handle a lot of really 'nice' data in a LOT of Excel sheets. It is all about music files (Billboard top 100)
I am afraid there really is a sheet for every year ... (Don't know this for sure yet...)
I definitely need to get this data in Access and get it normalized. (sigh ....)
The data is so 'nice' for the Import- and TransferSpreadsheet-wizard that the 'wizard' really chokes on it ;-)
Either the data is not...
|
by: cassetti |
last post by:
Here's the issue:
I have roughly 20 MS excel spreadsheets, each row contains a record.
These records were hand entered by people in call centers.
The problem is, there can and are duplicate phone numbers, and emails
and addresses even person names. I need to sift through all this data
(roughly 300,000+ records and use fuzzy logic to break it down, so that
i have only unique records.
|
by: Jules48 |
last post by:
I store comprehensive details of customers' "transactions" in Access
(2000). At the moment, I (or my staff) duplicate entry of the
information in an Excel spreadsheet which we use to extract stats and
charts and to number crunch etc.
Obviously, duplicating the data entry is onerous and open to error.
What I'd like to do is enter the data into the Access database then use
a query to compile a recordset of the latest set of records and then...
|
by: RichardP |
last post by:
Hi there everyone - I'm new to this forum.
I am having an issue when running an application from an instance of Access
which has been started through automation (early or late bound, makes no
difference).
No warning / confirmation messages are issued (eg. when running action
queries, deleting records from a datasheet, deleting database objects such as
tables).
| |
by: Oleg Konovalov |
last post by:
Hi,
I have a Java/JavaScript GUI application where I perform a lot of long DB
operations
, which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and clicks
again,
which created duplicate forcm submission and hence duplicate records.
So I am trying to disable the button as soon as it is clicked, and as soon
as it's done,
|
by: Hokiecow |
last post by:
I'm trying to import specific columns from an excel file
(Requirements.xls) into an access table (tblRequirements). Using VBA,
I'm able to import the entire excel file into table
(tblImportRequirements). Instead of going row by row of
(tblImportRequirements) and copying the fields needs to
(tblRequirements) it would be faster to just copy the column and over
write the other table's column. I'm not sure how to copy a few
columns from...
|
by: Charlotte |
last post by:
Hallo,
Graag hulp, want ik heb zelf geen oplossing
Al gegoogeld, doch zonder concreet resultaat
Op onze webserver (intranet) hebben we een website draaien
Een bepaalde ASP-pagina haalt zijn data uit een MDB
De mdb wordt gevoed door andere asp-pagina's
Tot hier geen probleem
|
by: khoward |
last post by:
Hi,
I have an Access 2007 database that contains customer contact information. There are over 8,000 that include name, organization (as a look-up column), email, phone, address, and events that each person should be invited to (also a look-up column).
Separate from this is an Excel spreadsheet that contains the some of the same information, with about 10,000 records. The overlap with duplicate names/records is probably about 50%, but of...
|
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...
|
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,...
| |
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: 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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |