I have a large array of data (1000 x 40 x 3) that I am inserting into a database table. It is incredibly slow, and so I was wondering if there is a quicker way of inserting array data into a table.
Here is the code I am currently using: -
' [Date],[Security],[Field]
-
With rs
-
For nSec = 0 To UBound(vtData, 2)
-
For ndate = 0 To UBound(vtData, 1)
-
For nfield = 1 To UBound(vtData, 3)
-
If IsNumeric(vtData(ndate, nSec, nfield)) Then
-
' Add to results table
-
.AddNew
-
!Security = vtSec(nSec)
-
!Date = vtData(ndate, nSec, 0)
-
!FieldName = vtFields(nfield - 1)
-
!FieldData = vtData(ndate, nSec, nfield)
-
.Update
-
End If
-
Next
-
Next
-
Next
-
End With
-
5 10031 ChipR 1,287
Recognized Expert Top Contributor
It may help to surround the whole process with
Access.Application.DBEngine.BeginTrans
and
Access.Application.DBEngine.CommitTrans
That seems to have helped a lot - thanks.
As an aside - is looping through the array the only/best way of inserting data into a table?
ChipR 1,287
Recognized Expert Top Contributor
I haven't found any alternative in vba, or vb for that matter.
NeoPa 32,557
Recognized Expert Moderator MVP
Like Chip, I'm not aware of any alternative way of importing data from an array.
How did the data arrive in the first place though? It may be that the data can better be imported from there.
The data arrives in an array. Thanks for all your input.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Joachim Klassen |
last post by:
Hi all,
first apologies if this question looks the same as another one I recently
posted - its a different thing but for the same szenario:-).
We are having performance problems when...
|
by: Alistair |
last post by:
Hi all,
I am creating a database based site that keeps track of books, who has read
them and the comments they have.
After a little help in M.P.I.asp.DB I managed to create a database (access...
|
by: Jaraba |
last post by:
I am working in a project that I need to parse an arrayt an select
records based upon the values parsed. I used the functions developed by
Knut Stolze in his article 'Parsing Strings'. I am...
|
by: freeskier |
last post by:
Hello,
Sorry for the newb question; I've spent a good amount of time trying to figure this out. I am fairly new to the Postgre world. I am currently in the process of upsizing several MS Access...
|
by: ashes |
last post by:
Hi,
I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net
When someone wants to register on the website, they fill out a form and the...
| |
by: AlexanderDeLarge |
last post by:
Hi!
I got a problem that's driving me crazy and I'm desperately in need of help.
I'll explain my scenario:
I'm doing a database driven site for a band, I got these tables for their discography...
|
by: hakkatil |
last post by:
Hi to all,
I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
|
by: cluce |
last post by:
I am trying to read a csv file with user info (username, password, email, address, city, zip, state, etc.) I am inserting the username, password, email into the aspnet_memberhsip table using the...
|
by: rando1000 |
last post by:
Okay, here's my situation. I need to loop through a file, inserting records based on a number field (in order) and if the character in a certain field = "##", I need to insert a blank record.
...
|
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: 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,...
|
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...
|
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...
|
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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |