I need to re-write my Flex app for C#.. this webservice will not run in VS2005, and I am pulling my hair out (not much left!). Does anyone have an idea why I get this error
System.NullReferenceException: Object reference not set to an instance of an object at VTResults.GetResult() This is a SQL query for DataSet that then serializes to a Class as Data Model for Flex. using System; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Diagnostics; /// <summary> /// Summary description for VTResults /// </summary> [WebService(Namespace = "http://velocitytrading.net/ResultsVT.aspx")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class VTResults : System.Web.Services.WebService { public class Results { public string SellDate; public string Ticker; public string BuyDate; public string Sell; public string Buy; public string Profit; public string Period; } [WebMethod] public Results[] GetResult() { string conn = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString; SqlConnection myconn = new SqlConnection(conn); SqlCommand mycomm = new SqlCommand(); SqlDataAdapter myda = new SqlDataAdapter(); DataTable mydt= new DataTable(); mycomm.CommandType = CommandType.StoredProcedure; mycomm.Connection = myconn; mycomm.CommandText = "dbo.Results"; myconn.Open(); myda.SelectCommand = mycomm; myda.Fill(mydt); myconn.Close(); myconn.Dispose(); int i = 0; Results[] dts = new Results[mydt.Rows.Count]; foreach (DataRow arow in mydt.Rows) { dts[i] = new Results(); dts[i].SellDate = arow["SellDate"].ToString(); dts[i].Ticker = arow["Ticker"].ToString(); dts[i].BuyDate = arow["BuyDate"].ToString(); dts[i].Sell = arow["Sell"].ToString(); dts[1].Buy = arow["Buy"].ToString(); dts[i].Profit = arow["Profit"].ToString(); dts[i].Period = arow["Period"].ToString(); i += 1; } return dts; } }

