0

This is my code into the wcf servis

public DataSet SelectUserDetails()

    {
        npgsqlcon.......   
        NpgsqlCommand cmd = new NpgsqlCommand("Select * from RegistrationTable", con);
        NpgsqlDataAdapter sda = new NpgsqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        sda.Fill(ds);
        cmd.ExecuteNonQuery();
        con.Close();
        return ds;
    }

And this is the xamarin forms code

public partial class MainPage : ContentPage { ServiceReference1.Service1Client objService = new ServiceReference1.Service1Client();

    public MainPage()
    {
        InitializeComponent();
        showdata();
    }

    private async void showdata()
    {

        DataSet ds = new DataSet();
        ds = await objService.SelectUserDetailsAsync();
        liste.ItemsSource = (System.Collections.IEnumerable)ds.Tables[0];
        
        
    }

this is the error

2
  • does ds.Tables[0] contain data? How are you binding the properties in your XAML?
    – Jason
    Commented Feb 22, 2021 at 14:01
  • Try to move the showdata() method intoOnAppearing() method.
    – Leo Zhu
    Commented Feb 23, 2021 at 1:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.