求解,为什么我的window窗体没有openevent()

StillMiss 2011-01-05 03:50:03
我下了个源码,照它里面的写。
就是到一个检索窗体w_manage,上面 4个按钮,检索,删,改,退出

实现的效果是:点击检索按钮,弹出对话框窗体w_2, 设置搜索的条件,起始日期,还有人员编号,跟姓名,性别。
点击确定,就传值到父窗体,就是w_manage。然后这个窗体取得,回传的值,检索数据、

我有两个问题,第一 在源码里, 他这个w_2窗体里,有一个postevent事件,返回值是none

我在自己的窗体可以就是没有看见这个事件

w_2窗体里postevent事件代码如下。

em_begin.text = "1900-01-01"
em_end.text = string(today(),"yyyy-mm-dd")

string temp

declare cur_bm cursor for
select 部门名称 from 部门表;

ddlb_bm.additem("")
open cur_bm;
do while sqlca.sqlcode = 0
fetch cur_bm into :temp;
if sqlca.sqlcode = 0 then
ddlb_bm.additem(temp)
end if
loop
close cur_bm;


然后在open()事件里写的是post event postevent()

我不太懂 为什么要这么写。

我就直接在open事件里将他那段代码copy了下。

点击确定后 ,关闭这个窗体,传值给父窗体,然后w_manage显示。
确定按钮click事件代码如下

string ls_reselect
string ls_begin,ls_end
string ls_bh
string ls_xm
string ls_bm
string ls_xb

ls_begin = trim(em_begin.text) + " 00:00:00"
ls_end = trim(em_end.text) + " 23:59:59"
ls_bh = trim(sle_bh.text) //人员编号
ls_xm = trim(sle_xm.text) //姓名
ls_bm = trim(ddlb_bm.text) //部门
ls_xb = trim(ddlb_xb.text) //性别
/////////////
select 部门编号
into :ls_bm
from 部门表
where 部门名称 = :ls_bm;
//////////////////////////
ls_reselect = " 出生日期 >= ('" + ls_begin + "')" + " and 出生日期 <= ('" + ls_end + "')"

if ls_bh <> "" then
ls_reselect = ls_reselect + " and 职工编号 LIKE '%" + ls_bh + "%'"
end if
//
if ls_xm <> "" then
ls_reselect = ls_reselect + " and 职工姓名 LIKE '%" + ls_xm + "%'"
end if
//
if ls_bm <> "" then
ls_reselect = ls_reselect + " and 部门代码 LIKE '%" + ls_bm + "%'"
end if
//
if ls_xb <> "" then
ls_reselect = ls_reselect + " and 职工性别 LIKE '%" + ls_xb + "%'"
end if
closewithreturn(parent,ls_reselect)



但是我的问题又出来了, 点击确定检索后,出现 database transcation infromation not available、

我使用的是quick select 数据源、 我不知道这里动态改变检索条件,如何设置数据源。。我不知道是不是要用sql那个数据源,如何设置动态变更查询。

求解。。。

...全文
113 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
StillMiss 2011-01-05
  • 打赏
  • 举报
回复
自己 大意了,变量少了一个 ,instance类型变量。 用来获取原来数据源句法的,(select * from 表)

本来是在父窗体open事件里 就绑定,只是没有检索出数据,这里我什么都没写,以至于我后来设定查询条件后,整个查询语句不对头。只有where 条件了、没有前面,(select * from 表)

所以出现了database transcation infromation not available错误、

如何定义自定义事件,我回头看看书去。~~~

先谢谢上面两位热心的帮助。
cryspigger 2011-01-05
  • 打赏
  • 举报
回复
两层程序,需要连接数据库,没连上自然就是database transcation infromation not available。

能不能说下你的最新进展?
看看有无其他具体的问题需要解决。
pcwe2002 2011-01-05
  • 打赏
  • 举报
回复
postevent是自己定义的事件,用post的原因是先让窗口打开再去执行postevent里面的代码,这样用户可以先看到界面。

出现 database transcation infromation not available
你看你的数据窗口有没有settransobject
Creating Windows CreateMDIWindow CreateWindow CreateWindowEx RegisterClass RegisterClassEx UnregisterClass Message Processing BroadcastSystemMessage CallNextHookEx CallWindowProc DefFrameProc DefMDIChildProc DefWindowProc DispatchMessage GetMessage GetMessageExtraInfo GetMessagePos GetMessageTime GetQueueStatus InSendMessage PeekMessage PostMessage PostQuitMessage PostThreadMessage RegisterWindowMessage ReplyMessage SendMessage SendMessageCallback SendMessageTimeout SendNotifyMessage SetMessageExtraInfo SetWindowsHookEx TranslateMessage UnhookWindowsHookEx WaitMessage Window Information AnyPopup ChildWindowFromPoint ChildWindowFromPointEx EnableWindow EnumChildWindows EnumPropsEx EnumThreadWindows EnumWindows FindWindow FindWindowEx GetClassInfoEx GetClassLong GetClassName GetClientRect GetDesktopWindow GetFocus GetForegroundWindow GetNextWindow GetParent GetProp GetTopWindow GetWindow GetWindowLong GetWindowRect GetWindowText GetWindowTextLength IsChild IsIconic IsWindow IsWindowEnabled IsWindowUnicode IsWindowVisible IsZoomed RemoveProp SetActiveWindow SetClassLong SetFocus SetForegroundWindow SetParent SetProp SetWindowLong SetWindowText WindowFromPoint Processes and Threads CreateEvent CreateMutex CreateProcess CreateSemaphore CreateThread DeleteCriticalSection DuplicateHandle EnterCriticalSection ExitProcess ExitThread GetCurrentProcess GetCurrentProcessId GetCurrentThread GetCurrentThreadId GetExitCodeProcess GetExitCodeThread GetPriorityClass GetThreadPriority GetWindowThreadProcessId InitializeCriticalSection InterlockedDecrement InterlockedExchange InterlockedIncrement LeaveCriticalSection OpenEvent OpenMutex OpenProcess OpenSemaphore PulseEvent ReleaseMutex ReleaseSemaphore ResetEvent ResumeThread SetEvent SetPr

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧