Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 8th, 2025, 10:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Database
PostPosted: May 23rd, 2005, 12:44 pm 
Offline

Joined: January 16th, 2005, 9:17 pm
Posts: 7
Location: Texel - The Netherlands
Hello all,

I have a script (in Opus 2.81 Pro) with the following code:

var myDB = new Database("FILEDSN = C:\\Program Files\\Common Files\\ODBC\\Data Sources\\Crash.dsn;")
var RecSet = myDB.ExecuteSQL("SELECT * FROM Mission;")
var num_records = RecSet.GetNumberOfRecords()
Debug.trace(num_records)

When I run the script I get an error "Action (3, -1) : Function Not Found : Check spelling and capitalisation"

Can't figure out what seems to be the problem :(

Jan


For this message Jan Nieuwenhuis has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 23rd, 2005, 3:34 pm 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Hello

Strangely enough this worked the first tun
through, then returned the same error on the second try.


Chris

_________________
Opus Resources and Services


For this message Chris Jones has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 31st, 2005, 3:05 pm 
Offline

Joined: January 16th, 2005, 9:17 pm
Posts: 7
Location: Texel - The Netherlands
Have also tested the code in Opus Pro 05 (demo version) and get the same error message, so it doesn't seem to be version related.

Jan


For this message Jan Nieuwenhuis has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 31st, 2005, 3:25 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
Try tracing RecSet, as it sounds like ExecuteSQL isn't returning a record set. Are there entries in that table?


For this message Dave Emberton has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 31st, 2005, 4:17 pm 
Offline

Joined: January 16th, 2005, 9:17 pm
Posts: 7
Location: Texel - The Netherlands
Hello,

Have modified the code a little so to avoid any mistakes... and added a Debug.trace(RecSet)

var myDB = new Database("FILEDSN = C:\crash.dsn;")
var RecSet = myDB.ExecuteSQL("SELECT * FROM CrashList;")
Debug.trace(RecSet)
var recCount = RecSet.GetNumberOfRecords()
Debug.trace(recCount)

The first time that I run the code the Debug.trace returns a "Database RecordSet Object" and 11 (as record count)... so this seems to be OK,
But, when I restart the same code I get a "false" and the error message...

Note: The first time that I run the code, Opus "asks" where the dsn is located, so I browse to the root directory of my harddisk where it is located. The second time I do not get the same "question"...

Jan

P.S. dsn looks as follows:

[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
DriverId=25
DefaultDir=C:\
DBQ=C:\crash.mdb


For this message Jan Nieuwenhuis has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 31st, 2005, 4:22 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
Jan Nieuwenhuis wrote:
Note: The first time that I run the code, Opus "asks" where the dsn is located, so I browse to the root directory of my harddisk where it is located. The second time I do not get the same "question"...


Did it do that before?

You don't have the double backslash in the DSN line, i.e..

var myDB = new Database("FILEDSN = C:\\crash.dsn;")

which might be part of the problem this time.


For this message Dave Emberton has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: June 1st, 2005, 1:43 pm 
Offline

Joined: January 16th, 2005, 9:17 pm
Posts: 7
Location: Texel - The Netherlands
Hello Dave,

1 or 2 backslashes gave the same result!!
The first time that I preview my publication, I have to select where the .dsn file is located and after selecting it, everything works OK!
However, when I preview again I don't need to select the file any more and I get an error.
When I close the publication and open it again, the results are the same as mentioned before... first time it works, then it gives an error.

To test the .dsn and the database I have also used the query wizard to select data and this works OK with no problems at all...

I also used the query wizard to get data and script code in the same publication...
Well, the data found by the query via the wizard is displayed OK everytime I preview the publication, but the data found by the code again gave an error the 2nd time...

The reason for using code instead of the wizard is simply that I want to be a little more flexible in setting up a query... e.g. the query (code) unfortunately can not be edited within the wizard.

Jan


For this message Jan Nieuwenhuis has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group