Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a datawindo accessing a dynamic temp table

Status
Not open for further replies.

Dom71555

IS-IT--Management
Feb 6, 2005
47
US
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()
 
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"
 
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
 
Thank you again. It worked great. I used a case statement in the objects color property as you suggested.

Dominick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top