0
Reply

XML Web Service help!

izmo

izmo

Apr 27 2005 12:12 AM
1.7k
Recently i have created a XML web service and web referenced it from within a mobile web form. In the the side of web service, i created a dataset that retrieved data from database. I am SURE that this web service is working fine because i can run the service through web browser. In the side of mobile web form, i do as following. I assign the table from dataset to dataview and then bind the dataview to objectlist's datasource. But unfortunately i get a message like "System.Exception - Must have one or more fields to databind. (Application may have autogenerated fields from an empty DataSource. To clear items, set DataSource to null.) Method:OnDataBinding" It said that the datasource is empty but when i use the Sqlcommand to assign table to DataReader dr and dr is assigned again to objectlist's datasource then it's FINE! i try IsPostBack but it is worst that nothing is displayed. Is it that i use the DataView improperly? It's urgent!...THANX private void Activities_Activate(object sender, System.EventArgs e) { //if(!IsPostBack) //{ // Create a new instance of the XML Web service. Service1 ActService = new Service1(); // Get a DataSet from the XML Web service. DataSet ActivityData = ActService.GetActivities(); // Create a new DataView using the Mountains table. DataView dv = new DataView(ActivityData. Tables["MediActivities"]); //SqlCommand myCommand = //new SqlCommand("select * from MediActivities", dbConnection); //dbConnection.Open(); //SqlDataReader dr = myCommand.ExecuteReader(); ObjectActivitiesList.DataSource = dv; // The name of the field to display ObjectActivitiesList.LabelField ="Activity_Name"; ObjectActivitiesList.AutoGenerateFields = true; ObjectActivitiesList.DataBind(); //} }

Next Recommended Forum