#眉標=MSN、 #副標=Windows Live Agents SDK開發實務(1) #大標=MSN機器人開發(下) #作者=文/圖 黃忠成 ============= 程式1 ## File1.ddl ? your name - code6421 ? 今天天氣如何 ? 天氣如何 ? 是晴天嗎 - 問氣象局吧. ================ ============= 程式2 ? 氣象局在那 - 你沒地圖嗎? - 左轉,右轉,問人吧 ================ ============= 程式3 + CHOICE=Anything 新消息 - 沒有 CHOICE 新消息 ================ ============= 程式4 using System; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace WebApplication1 { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string GetCompanyName(string customerID) { using (SqlConnection conn = new SqlConnection( ConfigurationManager.ConnectionStrings[ "NorthwindConnectionString"].ConnectionString)) { SqlCommand cmd = new SqlCommand( "SELECT CompanyName FROM Customers WHERE CustomerID = @ID", conn); cmd.Parameters.AddWithValue("@ID", customerID); conn.Open(); object result = cmd.ExecuteScalar(); if (result == null) return "沒找到"; return (string)cmd.ExecuteScalar(); } }}} ================ ============= 程式5 datasource GetCompanyName(AID) => GetCompanyNameResult {expire="now"} soap proxy http://localhost:50699/WebService1.asmx name GetCompanyName namespace http://tempuri.org/ action http://tempuri.org/GetCompanyName input string customerID = AID simple xml GetCompanyNameResult ================ ============= 程式6 ? 找客戶 AID=Anything RESULT=GetCompanyName(AID) - RESULT ================