asp.netдµÄweb serviceÀý×Ó
µÚÒ»£¬ н¨ÍøÕ¾£¬Ñ¡ÔñÀàÐÍΪasp.net web ·þÎñ¡£
ϵͳ×Ô¶¯ÎªÄ㽨Á¢Á˸öÎļþservice.asmx.Õâ¾ÍÊÇÒ»¸ö×î¼òµ¥µÄweb service·þÎñ¡£Äã¿ÉÒÔÖ±½ÓÔËÐв鿴Ч¹û¡£
µÚ¶þ£¬ÎÒÃÇÐèÒªµÄÊÇÐÞ¸Äservice.csÖеĴúÂ룬À´Âú×ãÎÒÃǵÄÒªÇó¡£
Ð޸ĺóµÄService.csÖеĴúÂëΪ£º
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://127.0.0.1/")] //µ÷ÓôËweb serviceµÄµØÖ·
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Èç¹ûʹÓÃÉè¼ÆµÄ×é¼þ£¬ÇëÈ¡Ïû×¢ÊÍÒÔÏÂÐÐ
//InitializeComponent();
}
//[WebMethod]
//public string HelloWorld() {
// return "Hello World";
//}
/// <summary>
/// ÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý by flysky 2008-04-25
/// </summary>
/// <param name="number">ÒªÅжϵÄÊý</param>
/// <returns>·µ»Ø½á¹û</returns>
[WebMethod(Description = "ÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý")] //ÉùÃ÷´Ëº¯ÊýΪweb service·½·¨£¬¿ÉÒÔ¹©Íâ ½çµ÷ÓÃ
public string IsPrimeNumber(int number)
{
// ÒÔÏÂΪËã·¨£¬Ã²ËƲ»ÊÇ×îÓŵÄ
string value = "";
if (number <= 0)
{
value = number.ToString() + "is not prime number";
return value;
}
else
&
Ïà¹ØÎĵµ£º
Asp.net DataListǶÌ×DataListµÄʵÏÖ
[ 2006-05-31 01:26:24 | ×÷Õß: Admin ]
×ÖÌå´óС: ´ó | ÖÐ | С
Êý¾Ý·þÎñ¿Ø¼þµÄǶÌ××îÖ÷ÒªµÄÊÇÊÇÄÚ²ã¿Ø¼þÊý¾ÝµÄ¼ÓÔغÍʼþµÄ´¥·¢¡£ DataListǶÌ×µÄÖصãÊÇÒªÔÚÍâ²ãDataListµÄItemDataBoundʼþÖÐÓÃe.Item.FindControl·½·¨À´ÕÒµ½Ç¶ÌײãDataListµÄid,±àдǶÌײãDataListµÄ°ó¶¨Êý¾Ý ......
RepeaterÔÚǰ̨ʹÓñȽÏÁé»î×ÔÓÉ£¬µ«ÓÐÒ»¸öÎÊÌâ¾ÍÊÇRepeater²»Ö§³ÖÖ±½Ó·ÖÒ³£¬Õâ¸öºÜ¶àÈË¿´ÆðÀ´¾ÍÓе㲻ÏëÓÃÁË£¬µ«ÎÒÏë´ó¼Ò¶¼ÖªµÀGridView¿Ø¼þ»òDataGrid¿Ø¼þÔÚÆôÓÃ×Ô´ø·ÖÒ³µÄʱºòÆäʵЧÂÊÊǷdz£µÍµÄ£¬´óµÄ²»Ëµ£¬Ò»µ«µ½ÁË°ÙÍò¼¶Êý¾ÝÒԺ󣬾ͻá¸Ð¾õÊǶàôµÄÍ´¿àºÍÎÞÄÍÁË£¬ËùÒÔ¼´Ê¹ÊÇÓÃDataGrid(GridView)¿Ø¼þ£¬¸ßÊÖÃÇ»¹ÊÇÖ»»á ......
ÄãÖ»ÒªÔÚWeb,configÎļþµÄ system.web ÅäÖýÚÏÂÌí¼ÓÒÔÏÂÅäÖãº
<globalization requestEncoding="GB2312" responseEncoding="GB2312"/>
µ±È»£¬ÄãÒ²¿ÉÒÔ½«“GB2312”¸ÄΪϵͳĬÈϵēUTF-8”£¬Ö»Òª¼ÓÉÏÕâÒ»ÅäÖã¬Ò³Ãæ¼ä´«ÖµµÄÂÒÂëÎÊÌâ¾Í½â¾öÁË¡£ ......
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ
¶¼¿ÉÓÃstring name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µ ......
½ñÌ죬ѧϰÁËASP.NETÖÐÁ¬½ÓÊý¾Ý¿âµÄ¸÷ÖÖ·½·¨£¬ÕâÊÇÎÒ×Ô¼ºµÄÒ»¸öС×ܽᣬ²»Ò»¶¨ÍêÈ«ÕýÈ·£¬½ö¹©²Î¿¼£¡ O(∩_∩)O~
Á¬½ÓSQLÊý¾Ý¿âµÄ·½·¨£º
(Ò»)¡¢ÔÚWeb.ConfigÖд´½¨Á¬½Ó×Ö·û´®£º
1¡¢
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename= ......