Posted by jimbooth97 in SWF Studio V3 on Jun 29 2008, 12:59 pm

Hi all,

I think I am having an issue with the "setSQL" call. The setSQL call works fine, but then when I try to open another table using setWhere, I only get the setSQL results back.. no error msgs.. has taken me 2 days to figure out that, since everything works so well.

here is the setSQL code (which works great)
ssCore.ADO.close();
var mysql:String="SELECT * FROM student WHERE username ='" + _root._username + "' AND pass = '" + _root.passw + "'";
ssCore.ADO.setSQL({sql:mysql});
ssCore.ADO.open ({}, {callback:'datafunctions.verifypass'});

The above code work perfectly, I get the results I expect. And, requests for data from tables before this call work perfectly using the setWhere.

here is the code I am using to open up the new table (after calling the setSQL command):

ssCore.ADO.close();
ssCore.ADO.setTable({name: "administrator"});
ssCore.ADO.setWhere ({clause:"ID = 'primary'"});
ssCore.ADO.open({}, {callback:'datafunctions.onOpenFinished2'});

Am I doing something wrong here? I am able to open and close tables at will until I use the execSQL call, then I only get the results of the setSQL results. It is as if it no longer accepts my setTable call.

Thanks for any help!

Jim


Posted by jimbooth97 in SWF Studio V3 on Jun 29 2008, 01:37 pm

well, i may have found the solution.. odd, just minutes after posting.

It appears if I call the setSQL with an empty string.. (as the HELP mentions) all is well..

ssCore.ADO.setSQL({sql:""});
ssCore.ADO.setTable ({name:'questions'});
var myclause="ques_label = '" + _root.whichchap + "'";
ssCore.ADO.setWhere({clause: myclause});
ssCore.ADO.open({},{callback:'datafunctions.onLoadQues'});

Hope this helps someone..

jim


Posted by northcode in SWF Studio V3 on Jun 29 2008, 06:17 pm

If you had peformed those operations using two different aliases (not the default "ADO") then it would have worked as well. The various methods you call, like setSQL, setTable, setWhere, just set properties. When you call open it looks at the properties you have set and does what you've asked it to do. The problem you ran into is that setSQL "overrides" the other settings. The others have to be specified together (in various combinations) to work but setSQL works all by itself. By setting setSQL to an empty string you are telling the plugin to ignore that setting and look at the other ones.