Loading ...
Sorry, an error occurred while loading the content.

Re: sql woes

Expand Messages
  • dnmeeks
    Thanks Tom - I did try that, and it didn t change the behavior, sorry I should have mentioned that. I was able to make it run by removing a call to another
    Message 1 of 3 , Aug 1, 2011
    View Source
    • 0 Attachment
      Thanks Tom -
      I did try that, and it didn't change the behavior, sorry I should have mentioned that.
      I was able to make it run by removing a call to another function inside that function that was failing with the "undefined" error.
      I know, it doesn't make any sense to me, but it "worked". I just added another button on my test form to run that other function "manually".
      I am finding this sql stuff really squirrely.

      Dan

      --- In nsbasic-app@yahoogroups.com, Computerhusky <computerhusky@...> wrote:
      >
      > Hi,
      > if DBRecords is not declared as a global variable (by a Dim DBRecords outside all Functions/Subs), then it is local to the function where the statement
      > DBRecords=results
      > is, and not known outside that function. That's the normal behaviour for all variables.
      > Kr
      > Tom
      >
      > Von meinem iPad gesendet
      >
      > Am 31.07.2011 um 23:49 schrieb "dnmeeks" <dan-meeks@...>:
      >
      > > Started with the sql example file, been experimenting with adding functions to learn how to manipulate a data base.
      > >
      > > From the original sql file, this statement in the initDB() function (with a new table name for my app):
      > >
      > > sqlList[databaseSize+2]=["SELECT * from DanCadDesignsTemp ORDER BY DesignName;", dataHandler]
      > >
      > > the dataHandler function includes this:
      > >
      > > DBRecords = results
      > >
      > > And then there are buttons (from the original example program), one of which does this (again, with a couple of mods for my project):
      > >
      > > Function btnCount_onclick()
      > > total=0
      > > startTime=SysInfo(10)
      > > For i=0 To DBRecords.rows.length-1
      > > total=total + CDbl(DBRecords.rows.item(i)["Vout"])
      > > Next
      > > txtMessage.value = "Total of " & DBRecords.rows.length & " recs is " & total & " in " & (SysInfo(10)-startTime) & " milliseconds."
      > > End Function
      > >
      > > I have added a new function, and the DBRecords.rows.length generates an error, because it says that DBRecords is not defined.
      > >
      > > So my question is - why is DBRecords "not defined" when I try to use it, after it was already assigned and working in another function?
      > >
      > > Thanks in advance -
      > >
      > > Dan
      > >
      > >
      > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.