C # WebServices with weather forecasts,
Background code:
C # code
- Protected void Page_Load (object sender, EventArgs e)
- {
- If (! IsPostBack)
- {
- WeatherWS ws = new WeatherWS ();
- IList <string> provinceDataSource = new List <string> ();
- DataSet proDs = ws. getRegionDataset ();
- DdlProvince. DataSource = proDs. Tables [0]. DefaultView;
- DdlProvince. DataTextField = "RegionName ";
- DdlProvince. DataValueField = "RegionID ";
- DdlProvince. DataBind ();
- }
- }
- Protected void button#click (object sender, EventArgs e)
- {
- WeatherWS ws = new WeatherWS ();
- String [] wsInfo = ws. getWeather (ddlCity. SelectedValue ,"");
- String result = string. Empty;
- For (int I = 0; I <wsInfo. Length; I ++)
- {
- Result + = wsInfo [I] + "<BR/> ";
- }
- Label1.Text = result;
- }
- Protected void ddlProvince_SelectedIndexChanged (object sender, EventArgs e)
- {
- WeatherWS ws = new WeatherWS ();
- DataSet cityDs = ws. getSupportCityDataset (ddlProvince. SelectedValue );
- DdlCity. DataSource = cityDs. Tables [0]. DefaultView;
- DdlCity. DataTextField = "CityName ";
- DdlCity. DataValueField = "CityID ";
- DdlCity. DataBind ();
- }
. Aspx code
C # code
- <Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
- <ContentTemplate>
- <Asp: DropDownList ID = "ddlProvince" runat = "server" AutoPostBack = "True"
- Onselectedindexchanged = "ddlProvince_SelectedIndexChanged">
- </Asp: DropDownList>
- <Asp: DropDownList ID = "ddlCity" runat = "server">
- </Asp: DropDownList>
- <Asp: Button ID = "Button1" runat = "server" onclick = "button#click" Text = "Button"/>
- <Br/>
- <Br/>
- <Br/>
- <Asp: Label ID = "Label1" runat = "server" Text = "Label"> </asp: Label>
- </ContentTemplate>
- </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.