Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. XML Web Service help!

XML Web Service help!

Scheduled Pinned Locked Moved ASP.NET
databasexmlhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexkwh
    wrote on last edited by
    #1

    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(); //} } gaz

    N 1 Reply Last reply
    0
    • A alexkwh

      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(); //} } gaz

      N Offline
      N Offline
      Noman Nadeem
      wrote on last edited by
      #2

      alexkwh wrote: DataView dv = new DataView(ActivityData. Tables["MediActivities"]); try DataView dv = ActivityData.Tables["MediActivities"].DefaultView; Now ... your Web service might not be return what you think ! check it though debug mode. ALSO, in the web service, you might have given the table a different name. so try DataView dv = ActivityData.Tables[n].DefaultView;where n is the zero-based index of your table. regards, Noman Nadeem :zzz:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups