Atozed Forums

Full Version: Build errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know this is a pretty simple question but I'm a pretty simple guy.

I am attempting to use a "trial" of IW 15.n to do a test app to evaluate the result.

I have built a simple two "form" app with the data VCL's embedded on the "UserSession" unit.

At design time when I reference a data VCL from the "main" form everything is fine.  But when I attempt to build the app  the references are not recognized by the build (compiler?) process and throw a reference error.

IE:

    With IWUserSession Do
      begin
        Query1.Close;
        Query1.SQL[0] := 'SELECT * FROM `members` ' +
        'WHERE `LastName` LIKE("' + IWEdit1.Text + '%")';
        Query1.Open;
      end;


result:

Compiling USSVI.dproj (Debug, Win32)
[dcc32 Error] Unit1.pas(34): E2003 Undeclared identifier: 'Query1'
.
.
[dcc32 Error] Unit1.pas(32): E2003 Undeclared identifier: 'IWUserSession'
...

Any hints?
Hi, try remove IW from UserSession, use only UserSession:
Code:
    With UserSession Do
      begin
        Query1.Close;
        Query1.SQL[0] := 'SELECT * FROM `members` ' +
        'WHERE `LastName` LIKE("' + IWEdit1.Text + '%")';
        Query1.Open;
      end;
The fix is as Jose describes above.

As a little "new user" background, what Jose describes will access the TIWUserData through the function you will find in the ServerController module. This function is automatically built for you, and is the best way to access the usersession data.

Let IW do the work for you. "Servercontroller" will be in your "uses", which exposes "UserSession" in your code.

Dan
(07-08-2020, 02:05 AM)DanBarclay Wrote: [ -> ]The fix is as Jose describes above.

As a little "new user" background, what Jose describes will access the TIWUserData through the function you will find in the ServerController module.  This function is automatically built for you, and is the best way to access the usersession data.

Let IW do the work for you.  "Servercontroller" will be in your "uses", which exposes "UserSession" in your code.

Dan

Thanks!

Verrwee, verrwee interesting?  Looks like new things to learn here.

Fred
(07-08-2020, 03:04 PM)TexasGofer Wrote: [ -> ]
(07-08-2020, 02:05 AM)DanBarclay Wrote: [ -> ]The fix is as Jose describes above.

As a little "new user" background, what Jose describes will access the TIWUserData through the function you will find in the ServerController module.  This function is automatically built for you, and is the best way to access the usersession data.

Let IW do the work for you.  "Servercontroller" will be in your "uses", which exposes "UserSession" in your code.

Dan

Thanks!

Verrwee, verrwee interesting?  Looks like new things to learn here.

Fred
Yes!  Very nice.  I found that if what I'm trying to do looks complicated, I'm probably over thinking it.

IW is well thought out.  The usersession object for each session is managed for you, just access it with the function provided and use it.  If you want other "session" variables or objects, put them on the usersession.  

BTW, where in Texas?  I speak Texan.  (currently in Corpus Christi)

Dan
I need to save a bunch of session variables so Now I know how. (That's the on topic part.)

Dallas northern suburb. Trying to get moved to our property near Larue, TX (Just a little south of New York.)

Been to Corpus more than once. Another fine Texas location if you like seafood and catch'en and not fish'en. :-)

Fred