Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 4:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: NextRecord() problem
PostPosted: May 9th, 2007, 7:10 am 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
I'm using Database with opus
When I use it from the tools it works fine ,but when i use the script it works fine for displaying the first record of the table ,however the NextRecord() function is not working.

I use this script with OnShow Page
var db = new Database("DSN=mydb2;")
var RecSet = db.ExecuteSQL("SELECT * FROM Table1 ;")

and then i put a button with this
RecSet.NextRecord()

when I press the button I expect the next record to be displayed but nothing happen at all

What is the problem Please Help


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 9th, 2007, 7:50 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi OP,

Firstly, you don't need the VAR - it's only used to make variable local to a function. It won't affect anything in this case.

Second, you don't say how you are displaying the information.

Create a text box and insert a constant expression of RecSet. followed by the name of your field from the DB. This should then move forward thought the record set as you click next

Mack

P.S This is only if you are displaying records. If you are using text input boxes, then you need to read the RecSet.myField in to myVariable and then do this again AFTER you have clicked run the NextRecord command.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 9th, 2007, 8:37 am 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
Hi Mac again

1.I copied the script from the opus Manual

This is what in the manual
var myDB = new Database("FILEDSN=catalogue.dsn;")
var Rset = myDB.ExecuteSQL("SELECT * FROM Products")
Rset.NextRecord()


2. How I create a constant expression of RecSet
Actually I have 3 inputboxes on the page Name,Test1,Test2,Test3
and I have 4 fields in the table Name,Test1......etc
When i run the program the iinoutboxes reads the first record with all fields ,but the next record doesn't work


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 9th, 2007, 9:13 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi OP,

DBs seem to be the in thing at the moment :-)

Skip the constant expression, only useful if displaying records. If you need to edit the records then use this.

After the execute SQL command on the ONSHOW add ;

myVariable = RecSet.myFIELDNAME

In the text input box, create a variable that matches the myVariable above. This will display the first record.

On the next record button. Keep the

RecSet.NextRecord() command and add the following
myVariable = RecSet.myFIELDNAME

This will read the next record into your variable displayed in the text input box.

Mack

If it doesn't work, post the IMP and I'll check

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 9th, 2007, 10:43 am 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
A lot of Thankssss Mac
It's working this way.

Sorry for bothering you with my Qs.


For this message opuslover has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 48 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