小弟要做一个手机短信动态发送
短信发送要求:
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;