发送短信后更新计数 [英] Updating the count after sending SMS

查看:68
本文介绍了发送短信后更新计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数据库表:tblPerson as,



 id name mobile_no sentcount 
1 Ram 98 **** **** 4
2 Shyam 98 ******** 4
3 Hari 98 ******** 5
4 Raj 98 ****** ** 3





现在我想发送短信给那些发送数量少于最大发送数量的人。(这里maxm sentcount = 5 );

i使用sql storeproc as:



 创建  proc  sp_getMobileNo 
@ sentcount int
as
选择选择 top 2 mobile_no + ' ,' as ' data()' 来自 tblPerson 其中 sentcount< @sentcount ORDER BY NEWID() for xml path(' ')) as MobileNo





它的结果如下:

 MobileNo 
----------------------
98 ********,98 ********
-----------------------





I使用linq将ASP.Net应用程序C#中的数据作为语言获取并成功将文本消息发送到两个选定的数字;我使用linq作为:

 linqDataContext db =  new  linqDataContext(); 
var query = db.sp_getMobileNo( 5 );
string mobileNum = query.MobileNo;





但是我想要更新或增加已发送短信的两个人的发送数量。

所以请建议我该怎么办?是以xml路径的形式将移动设备作为xml路径重新检索的方式是正确的方法来检索手机号码吗?

请帮助!!!

解决方案

< blockquote>最后我找到了解决方案。首先是获得手机号码的选择。因为在我的情况下,XML路径是不好的选择。我只是选择了mobile_no和person id,将它复制到datatable并使用foreach循环我把id和mobile放在数组中。我联系了手机号码。以及逗号以获取mobile_no的形式98 **********,98 *********,。因此更新了同一循环中id的计数。


I have database table: tblPerson as,

id name     mobile_no   sentcount
1   Ram     98********   4
2   Shyam   98********   4
3   Hari    98********   5
4   Raj     98********   3



now i want send sms to those two person who have sentcount less than the maximum sentcount.(here maxm sentcount=5);
i used sql storeproc as:

create proc sp_getMobileNo
@sentcount int
as
Select (select top 2 mobile_no + ',' as 'data()' from tblPerson  where sentcount<@sentcount ORDER BY NEWID()for xml path('')) as MobileNo



it gives the result as:

MobileNo
----------------------
98********, 98********
-----------------------



I have used linq to get the data in the ASP.Net application C# as language and succeded to send text message to two selected numbers;i used linq as:

linqDataContext db= new linqDataContext();
var query=db.sp_getMobileNo(5);
string mobileNum=query.MobileNo;



but i want to update or increase the sentcount of those two whom sms has been sent.
So please suggest me what to do? Is the way of retreving the mobile in concated form as xml path the correct way to retreive the mobile number?
Please help!!!

解决方案

Finally i have found the solution. First of all the option of getting mobile no. as XML path was bad option in my case. I simply selected the mobile_no along with person id,copied it to datatable and using foreach loop i put both id and mobile in array. i concatenated the mobile no. along with comma to get mobile_no in the form 98**********,98*********,. and so updated the count of the id inside the same loop.


这篇关于发送短信后更新计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆