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 2233
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
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |