WebService 发布后调用返回结果和我测试的不一样

-一个大坑 2017-10-19 04:23:14
<asp:Button ID="btnQuery" runat="server" Text="Query" Width="58px" OnClick="btnQuery_Click" style="height: 26px" /><br />

protected void btnQuery_Click(object sender, EventArgs e)
{
string emplid = string.Empty;
string[] emplidArr = { "Z20171010", "Z20171011", "Z20171012" };
for (int i = 0; i < emplidArr.Length; i++)
{
emplid = emplid + ",'" + emplidArr[i] + "'";
}
emplid = emplid.TrimStart(',');

try
{
string strSql1 = "UPDATE person p SET p.building_code = '', p.room_id = '', p.active = 'O' WHERE p.emplid in (" + emplid + ") and p.active='Y'";
string strSql2 = @"UPDATE accomm a SET a.odate = trunc(sysdate), a.outdormadm = 'system', a.action_type = 'O', a.out_reason = '離職退宿'
WHERE a.accomm_id in (select p.accomm_id from person p where p.emplid in (" + emplid + ") and p.active = 'Y') and a.action_type = 'I'";
BLLDAL myInsert = new BLLDAL(this.sconn);
myInsert.ExecuteSQL(strSql1);
myInsert.ExecuteSQL(strSql2);
}
catch (Exception ex)
{

}
}

这样写的调试没问题
...全文
830 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
exception92 2017-11-01
  • 打赏
  • 举报
回复
Dorm_CheckOut方法 先返回一个单独的字符串,不进行数据库的读取操作,看是否是操作数据库的原因。
正怒月神 2017-11-01
  • 打赏
  • 举报
回复
网络问题?
-一个大坑 2017-10-20
  • 打赏
  • 举报
回复
刚刚访问不了了,提示Service Unavailable 重启了下,现在又好了,感觉很不稳定
-一个大坑 2017-10-19
  • 打赏
  • 举报
回复
写了个service,然后用控制台调用就返回NO


[WebMethod]
    public string Dorm_CheckOut(string[] emplidArr)
    {
        int num = 0;
        string emplid = string.Empty;
        string result = string.Empty;
        for (int i = 0; i < emplidArr.Length; i++) 
        {
            emplid = emplid+",'"+ emplidArr[i]+"'";
        }
        emplid = emplid.TrimStart(',');

            try
            {
                string strSql1 = "UPDATE person p SET p.building_code = '', p.room_id = '', p.active = 'O' WHERE p.emplid in (" + emplid + ") and p.active='Y'";
                string strSql2 = @"UPDATE accomm a SET a.odate = trunc(sysdate), a.outdormadm  = 'system', a.action_type = 'O', a.out_reason  = '離職退宿'
                                 WHERE a.accomm_id in (select p.accomm_id  from person p  where p.emplid in (" + emplid + ") and p.active = 'Y') and a.action_type = 'I'";
                BLLDAL myInsert = new BLLDAL(this.sconn);
                myInsert.ExecuteSQL(strSql1);
                myInsert.ExecuteSQL(strSql2);
            }
            catch (Exception ex) 
            {
                num++;
            }
        
        if (num == 0) 
        {
            return "OK";
        } 
        else
        {
            return "NO";
        }
    }

 static void Main(string[] args)
        {
            string[] emplidArr = {"Z20171010", "Z20171011", "Z20171012" };
            WebReference1.Dorm_CheckOutWebService dormService = new WebReference1.Dorm_CheckOutWebService();
            Console.WriteLine(dormService.Dorm_CheckOut(emplidArr));
            Console.ReadKey();
        }

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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