Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ DatabaseColumnValues return undefined value

DatabaseColumnValues return undefined value

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nozshand   (5 posts)  Bio
Date Thu 25 Dec 2014 09:48 AM (UTC)
Message
Hi, I am trying to read data from sqlite using jscript, however DatabaseColumnValues function seems return undefined values, since there is no jscript example on DatabaseColumnValues, I am hoping someone can point me in the right direction.

Below is my code

function load()
{
DatabaseOpen(db, dbFilename, 6);
DatabasePrepare (db, "select * from rooms");
var names = DatabaseColumnNames (db);
var cols = DatabaseColumns (db);

Note("Columns = " + cols);
Note (DatabaseError(db));
var rc = DatabaseStep(db) ;
Note (DatabaseError(db));
while (rc == 100)
{
Note ("begin");
var values = DatabaseColumnValues(db);
for(var i = 0; i < cols; i++)
{
Note(names+"="+values);
}

var rc = DatabaseStep (db) ;
}

DatabaseFinalize (db);
DatabaseClose(db);
}

here is the result

Columns = 7
not an error
row ready
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
begin

undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined
undefined=undefined


the row number and column number all match the database, but the values are always undefined.
Top

Posted by Nozshand   (5 posts)  Bio
Date Reply #1 on Thu 25 Dec 2014 10:07 AM (UTC)
Message
Never mind, I figured out why, it returns variant type. In jscript you need to cast it into VBArray
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,488 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.