C # WebServices with weather forecasts,

Source: Internet
Author: User

C # WebServices with weather forecasts,

Background code:

C # code  
  1. Protected void Page_Load (object sender, EventArgs e)
  2. {
  3. If (! IsPostBack)
  4. {
  5. WeatherWS ws = new WeatherWS ();
  6. IList <string> provinceDataSource = new List <string> ();
  7. DataSet proDs = ws. getRegionDataset ();
  8. DdlProvince. DataSource = proDs. Tables [0]. DefaultView;
  9. DdlProvince. DataTextField = "RegionName ";
  10. DdlProvince. DataValueField = "RegionID ";
  11. DdlProvince. DataBind ();
  12. }
  13. }
  14. Protected void button#click (object sender, EventArgs e)
  15. {
  16. WeatherWS ws = new WeatherWS ();
  17. String [] wsInfo = ws. getWeather (ddlCity. SelectedValue ,"");
  18. String result = string. Empty;
  19. For (int I = 0; I <wsInfo. Length; I ++)
  20. {
  21. Result + = wsInfo [I] + "<BR/> ";
  22. }
  23. Label1.Text = result;
  24. }
  25. Protected void ddlProvince_SelectedIndexChanged (object sender, EventArgs e)
  26. {
  27. WeatherWS ws = new WeatherWS ();
  28. DataSet cityDs = ws. getSupportCityDataset (ddlProvince. SelectedValue );
  29. DdlCity. DataSource = cityDs. Tables [0]. DefaultView;
  30. DdlCity. DataTextField = "CityName ";
  31. DdlCity. DataValueField = "CityID ";
  32. DdlCity. DataBind ();
  33. }

. Aspx code

C # code  
  1. <Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
  2. <ContentTemplate>
  3. <Asp: DropDownList ID = "ddlProvince" runat = "server" AutoPostBack = "True"
  4. Onselectedindexchanged = "ddlProvince_SelectedIndexChanged">
  5. </Asp: DropDownList>
  6. <Asp: DropDownList ID = "ddlCity" runat = "server">
  7. </Asp: DropDownList>
  8. <Asp: Button ID = "Button1" runat = "server" onclick = "button#click" Text = "Button"/>
  9. <Br/>
  10. <Br/>
  11. <Br/>
  12. <Asp: Label ID = "Label1" runat = "server" Text = "Label"> </asp: Label>
  13. </ContentTemplate>
  14. </Asp: UpdatePanel>

Slow access ,,,...

Step 1 Add a Web reference

 

Then there is something on the page... webServices clearly


In the C language, what is the symbol (->) and how to use it?

This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.

Symbol in C Language <Yes

Left shift operator (<)

Removes all the binary bits of an operation object from the left and adds 0 to the right ).

For example, a = a <2 shifts the binary bits of a two places to the left and complements 0 to the right,

Move 1 to the left and then a = a * 2;

If the left shift does not include 1 in the Discard high position, then shifts one bit left, which is equivalent to multiplying the number by 2.
Shift right operator (>)

Shifts all the binary bits of a number to several places to the right, and adds 0 to the left of the positive number, 1 to the left of the negative number, and discards the right of the negative number.

The operand shifts one digit to the right, which is equivalent to dividing the number by 2.

For example, a = a> 2 shifts the binary bit of a two places to the right,

0 or 1 to see whether the number is positive or negative.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.