Hello,
Below is the code for web api, I wanted to consume/call the web api in xamarin forms and bind the result to the picker.
- [System.Web.Http.HttpGet]
- public HttpResponseMessage GetNames()
- {
- //Conectionstrings for different databases
- string client1 = ConfigurationManager.ConnectionStrings["client_db1"].ConnectionString;
- string client2 = ConfigurationManager.ConnectionStrings["client_db2"].ConnectionString;
- string client3 = ConfigurationManager.ConnectionStrings["client_db3"].ConnectionString;
- //Applying the select command for different databases
- SqlConnection con = new SqlConnection(client1);
- SqlDataAdapter da1 = new SqlDataAdapter("select provider_name,Id from Provider_details", con);
- DataSet ds1 = new DataSet();
- da1.Fill(ds1);
- con = new SqlConnection(client2);
- da1.SelectCommand.Connection = con;
- DataSet ds2 = new DataSet();
- da1.Fill(ds2);
- con = new SqlConnection(client3);
- da1.SelectCommand.Connection = con;
- DataSet ds3 = new DataSet();
- da1.Fill(ds3);
- //Merging the database to select the provider name
- ds1.Merge(ds2);
- ds1.Merge(ds3);
- return Request.CreateResponse(HttpStatusCode.OK, ds1);
- }
Please help me,
Thanks
Sachin SinghPosted Dec 2, 2020, 4:59 AM
Sachin SinghPosted Dec 2, 2020, 4:19 AM
(data);
Demo CloudPosted Dec 2, 2020, 4:09 AM
>().Result.ToList();
>(data);
Sachin SinghPosted Dec 2, 2020, 4:04 AM
>(data) ;
Demo CloudPosted Dec 2, 2020, 3:57 AM
Sachin SinghPosted Dec 2, 2020, 3:54 AM
Demo CloudPosted Dec 2, 2020, 3:40 AM
Sachin SinghPosted Dec 2, 2020, 3:34 AM
Demo CloudPosted Dec 2, 2020, 3:30 AM
Sachin SinghPosted Dec 2, 2020, 3:18 AM
Demo CloudPosted Dec 2, 2020, 3:07 AM
Sachin SinghPosted Dec 1, 2020, 11:30 PM
>().Result.ToList();