INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Need help with a datawindo accessing a dynamic temp table

Need help with a datawindo accessing a dynamic temp table

(OP)
I am trying to create a temporary table that is loaded each timea user logs into the application.
I am building the table dynamically and my error checks are coming out showing no errors.
However, when I try to build the SQL statement to load the contents of the temp table, I do not see
any rows.
The li_errorSQLSELECT shows a 1 whereas the li_retrieve is showing 0 (which I think means 0 rows)

I tested the SQL statement and I do get rows returned.

Is what I am trying to do even possible?
Thank you for the help


ls_createtable = 'create table #useraccount (username varchar(20),
+ 'password varchar(10), ' &
+ 'staffid varchar(10), ' &
+ 'accesslevel varchar(3), '&
+ 'stafftype varchar(3), '&
+ 'department varchar(25)) '

// Insert data to the temp table
ls_inserttable = 'insert into #useraccount ' &
+ 'SELECT DISTINCT dbo.useraccount.username, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'dbo.staffmember.staffstateid, ' &
+ 'accesslevel = null, ' &
+ 'stafftype = null, ' &
+ 'dbo.staffmember.departmentname' &
+ 'FROM dbo.person, dbo.staffmember, dbo.useraccount ' &
+ 'WHERE ( dbo.person.personid = dbo.staffmember.personid ) and ' &
+ '( dbo.useraccount.personid = dbo.person.personid ) and ' &
+ '( dbo.useraccount.disable = 0 ) and ' &
+ '( dbo.staffmember.teacher = 1 ) and ' &
+ '( dbo.staffmember.enddate is null ) and ' &
+ 'dbo.staffmember.staffstateid is not null and ' &
+ 'dbo.staffmember.counselor <> 1 '


execute immediate :ls_createtable using sqlca;
if sqlca.sqlcode = 0 then
execute immediate :ls_inserttable using sqlca;
if sqlca.sqlcode = 0 then
messagebox("Insert error", sqlca.sqlerrtext)
end if
else
messagebox("Create error", sqlca.sqlerrtext)
end if

ls_gettemptabledata = 'SELECT username, password,staffid,accesslevel,stafftype,department FROM #useraccount '

// retrieve the teacher log id lookup table
li_errorSQLSELECT = dw_2.SetSqlSelect(ls_gettemptabledata)
[/in
dw_2.settransobject(SQLCA)
li_retrieve = dw_2.retrieve()

RE: Need help with a datawindo accessing a dynamic temp table

SQLCA.SQLCODE = 0 indicates no errors,

Make your statements IF SQLCA.Sqlcode <> 0 THEN ... to show errors in messageboxes.

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

RE: Need help with a datawindo accessing a dynamic temp table

(OP)
Thank you for your reply. I corrected that.
Do you know if there is a way to change the color of an oval object in a datawindow object depending on the value of other data retrieved?

Thank you again

mbalant I found your youtube video Multiple Datawindows Sharing the Buffered result Set very helpful

RE: Need help with a datawindo accessing a dynamic temp table

You can put an expression on the object's color property to change it.

Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

RE: Need help with a datawindo accessing a dynamic temp table

(OP)
Thank you again. It worked great. I used a case statement in the objects color property as you suggested.

Dominick

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close