------------- WebService1.asmx. cs ----------------- public class WebService1: System. web. services. webService {[WebMethod] public int Add (int a, int B) {return a + B;} [WebMethod] public DataSet GetStudent () {string constr = ConfigurationManager. connectionStrings ["studentConstr"]. connectionString; string SQL = "select * from student"; SqlDataAdapter adapter = new SqlDataAdapter (SQL, constr); DataSet ds = new DataSet (); adapter. fill (ds); return ds ;}===================================web. config =====================================< configuration> <system. web> <webServices> <protocols> <add name = "HttpGet"/> </protocols> </webServices> <compilation debug = "true" targetFramework = "4.0"/> </system. web> <connectionStrings> <add name = "studentConstr" connectionString = "data source = .; initial catalog = student; user id = sa; password = 111111; "/> </connectionStrings> </configuration> ------- WebAddStudent. aspx front-end ------------- <body> <form id = "form1" runat = "server"> <div> <asp: textBox ID = "TextBox1" runat = "server"> </asp: TextBox> & nbsp; + <asp: textBox ID = "TextBox2" runat = "server"> </asp: TextBox> & nbsp; <asp: button ID = "Button1" runat = "server" Xonclick = "button#click" Text = "Button"/> & nbsp; <asp: textBox ID = "TextBox3" runat = "server"> </asp: TextBox> <br/> <asp: gridView ID = "GridView1" runat = "server"> </asp: GridView> </div> </form> </body> ------- WebAddStudent. aspx. cs background ------------ protected void button#click (object sender, EventArgs e) {localhost. webService1 ws = new localhost. webService1 (); this. textBox3.Text = ws. add (Convert. toInt32 (this. textBox1.Text), Convert. toInt32 (this. textBox2.Text )). toString (); this. gridView1.DataSource = ws. getStudent (); this. gridView1.DataBind () ;}========================== Web. config =========================< configuration> <configSections> <sectionGroup name = "applicationSettings" type = "System. configuration. applicationSettingsGroup, System, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 "> <section name =" userWebService. properties. settings "type =" System. configuration. clientSettingsSection, System, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 "requirePermission =" false "/> </sectionGroup> </configSections> <system. web> <compilation debug = "true" targetFramework = "4.0"/> </system. web> <applicationSettings> <userWebService. properties. settings> <setting name = "userWebService_localhost_WebService1" serializeAs = "String"> <value> http://localhost:1095/WebService1.asmx </Value> </setting> </userWebService. Properties. Settings> </applicationSettings> </configuration>