| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1527 人关注过本帖, 1 人收藏
标题:嵌套游标!~!
只看楼主 加入收藏
zk_1214
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2007-7-17
收藏(1)
 问题点数:0 回复次数:0 
嵌套游标!~!

小弟要做一个手机短信动态发送
短信发送要求:
1,SQL语句查询出对应的会员手机号码。后台解析SQL查询语句;
2,短信发送内容。

(如图:)

图片附件: 游客没有浏览图片的权限,请 登录注册

我用了嵌套游标(查询条件和表名是动态的故用嵌套游标查询!)请各位高手帮小弟看看这样做还对~请各位多多指教!谢谢~!

long ll_row,ll_count

string ls_from,ls_time
datetime ld_time

ld_time = datetime(date(uo_1.uf_getfrom()),time(sle_1.text))

//SQL语句判断
string ls_sql
if trim(sle_sql.text) = "" then
messagebox("提示信息","输入的SQL语句有错请检查")
return
else
ls_sql = sle_sql.text
end if

//短信内容判断
string ls_message//短信内容
if trim(mle_message.text) = "" then
messagebox("提示信息!","请输入短消息内容!")
return
else
ls_message = mle_message.text
end if
string ls_mobile
string ls_t_name
string ls_where
DECLARE my_table CURSOR for
select t_name from tablename order by t_name;
OPEN my_table;

FETCH my_table INTO :ls_t_name;

do
if sqlca.sqlcode = 0 then
//嵌套
DECLARE my_where CURSOR FOR
select mobile from ls_t_name where mobile= :ls_where;

OPEN my_where;
do
FETCH my_where into :ls_where;
if sqlca.sqlcode = 0 then

ls_sql= ls_t_name + ls_where;
//ls_sql="select distinct" + "mobile" + "from" + "ls_t_name" + "where" ls_Where like '%" + this.text + "%'
ll_row = dw_2.InsertRow( dw_2.GetRow() + 1 )
dw_2.ScrollToRow( ll_row )
dw_2.SetFocus()
dw_2.SetColumn( 1 )
// dw_2.object.card_num[ll_row]=ls_card_num
dw_2.object.Mobile[ll_row]=ls_where
dw_2.object.content[ll_row]=ls_message
dw_2.object.reply_type[ll_row]='0'
dw_2.object.isdeal[ll_row]='0'
dw_2.object.reg_date[ll_row]=gf_today_time()
dw_2.object.plan_date[ll_row]=ld_time
dw_2.object.writer[ll_row] = "平台,短消息发送功能"

FETCH my_where into :ls_where;
end if

Loop while sqlca.sqlcode = 0

close my_where;
if f_p_save_db(dw_2) = 1 then
messagebox("提示信息","操作成功!")
//close(parent)
return
else
messagebox("提示信息","操作失败!")
return
end if

end if
fetch my_table into :ls_t_name;
Loop while sqlca.sqlcode = 0
close my_table;



kBJDGyhg.jpg (36.47 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 嵌套 游标 
2007-08-13 09:29
快速回复:嵌套游标!~!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014347 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved