The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Import from Database

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
DrMK Posted - 03/24/2020 : 06:55:10 AM
Origin 2019b (32-bit)
9.6.5.169
Copyright © 1991-2019 OriginLab Corporation
Windows 10

Hello,

I've got different workbooks in different Folders in my Project. For each workbook I wrote a SQL-Code for a Database-Import.

Is there any possibility to run the Import simultaneously for all workbooks with one button?

Currently I have to Import for each workbook itself.

Thank you!

Matej
1   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 03/24/2020 : 08:43:15 AM
Hi,

Please check this page for script to import from database.
https://www.originlab.com/doc/LabTalk/examples/general-Import#Import_from_Included_Sample_Access_Database

To loop over each workbook, please refer to this page:
https://www.originlab.com/doc/LabTalk/ref/Document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects

Sample script can look like this:

Doc -e W
{
string strdb$ = system.path.program$ +
                "Samples\Import and Export\stars.mdb";

string strConn$="Provider=Microsoft.Jet.OLEDB.4.0;
                Data Source=%(strdb$); User ID=; Password=;";

// The SQL
string strSQL$="SELECT Stars.Index, Stars.Name, Stars.LightYears, Stars.Magnitude
                FROM Stars
                WHERE Stars.LightYears<=100
                ORDER BY Stars.Magnitude, Stars.LightYears";

// Connect database and submit the SQL
dbEdit change conn:=strConn$ sql:=strSQL$;
// Import data
dbImport;
// Disconnect the database
dbEdit remove;
}



James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000