Web services Visual Studio 2010中的Web服务C#Null异常错误

Web services Visual Studio 2010中的Web服务C#Null异常错误,web-services,Web Services,我的Web服务URL链接: 我正在使用GetUpComingMovies操作 * * 这是我在VS2010中编写的代码,但它给了我一个空异常错误 Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack tr

我的Web服务URL链接:

我正在使用GetUpComingMovies操作

*

*

这是我在VS2010中编写的代码,但它给了我一个空异常错误

Object reference not set to an instance of an object. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 



Line 25:             int year = Convert.ToInt32(TextBox2.Text);
Line 26:             UpcomingMovie[] ucome = mi.GetUpcomingMovies(month, year);
Line 27:             Label1.Text = ucome.ToString();
Line 28:       
Line 29:         }
我需要通过在gui中输入月份和年份来获得电影的名称,但它要么不给我结果,要么给我空错误

如何获取即将到来的电影操作的数据?
谢谢

很可能
Label1
ucome
为空。我们不容易判断-我建议您添加诊断或使用调试器。(在数组上调用
ToString
无论如何都不会给您提供有用的输出。)@JonSkeet我尝试过这样做
Label1.Text=ucome[0]。MovieName
它也会给我同样的错误是的,如果
Label1
ucome
为空,那么肯定还会出现
NullReferenceException
。您需要做的第一件事是找出其中哪些是空的,以及为什么。@JonSkeet我已经调试过的是
ucome
null。并捕获月份和年份。但是我就是不能把数据拿出来,我也不知道为什么..好吧,听起来你需要先检查一下网络服务的连接情况。
Object reference not set to an instance of an object. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 



Line 25:             int year = Convert.ToInt32(TextBox2.Text);
Line 26:             UpcomingMovie[] ucome = mi.GetUpcomingMovies(month, year);
Line 27:             Label1.Text = ucome.ToString();
Line 28:       
Line 29:         }