PLZ帮助解决使用Web服务消耗的年龄计算应用程序中的此错误 [英] plz help solve this error in age calculation apps using webservice consume

查看:65
本文介绍了PLZ帮助解决使用Web服务消耗的年龄计算应用程序中的此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:-ystem.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> System.ArgumentOutOfRangeException:Year,Month和Day参数描述了一个无法表示的DateTime。



在System.DateTime.DateToTicks(Int32年,Int32月期,Int32天)






代码如下: -



Error:-ystem.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.

at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)



Code following:-

namespace Age_Calculator_Apps
{
    public partial class Form1 : Form
    {
        //ServiceReference1.Age_calculationSoapClient obj = new ServiceReference1.Age_calculationSoapClient();
        localhost.Age_calculation obj = new localhost.Age_calculation();
        int day, month, year;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

            day = Convert.ToInt32(textBox1.Text.ToString());
            month = Convert.ToInt32(textBox2.Text.ToString());
            year= Convert.ToInt32(textBox3.Text.ToString());

            int days = obj.converttodaysweb(day,  year, month);

            MessageBox.Show("you are"+ " "+ days +""+ "days year old");
        }
    }
}

推荐答案

总猜。



在Age_Calculation中,我认为它试图获得已发生的总滴答声。



检查你的方式叫它,因为你正在放弃



日,年,月。



错误说明系统日期时间不正确,System.DateTime.DateToTicks(Int32年,Int32月,Int32日)



尝试更改代码以调用obj中的obj年,月,日的顺序。
As a total guess.

Inside that Age_Calculation, I think it is trying to get the total Ticks that have occurred.

Check the way in which you call it, as you are passing up

Day, Year, Month.

The error is stating that the system date time is not correct, System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)

Try changing your code to call the obj in the order of Year, Month, Day.


这篇关于PLZ帮助解决使用Web服务消耗的年龄计算应用程序中的此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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