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 SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 11:59 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 6:30 PM EST
>().Result.ToList();
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 10:18 PM EST
Demo Cloud168 reputationPosted Dec 1, 2020, 10:30 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 10:34 PM EST
Demo Cloud168 reputationPosted Dec 1, 2020, 10:40 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 10:54 PM EST
Demo Cloud168 reputationPosted Dec 1, 2020, 10:57 PM EST
Demo Cloud168 reputationPosted Dec 1, 2020, 11:09 PM EST
>().Result.ToList();
>(data);
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 11:19 PM EST
(data);
Demo Cloud168 reputationPosted Dec 1, 2020, 10:07 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Dec 1, 2020, 11:04 PM EST
>(data) ;
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts