上面代碼使用與Application_Load()相同的語法來訪問dataset
AddEvent()方法稍微有點復雜
● 接受來自客戶的事件數據
● 使用那些數據創建SQL INSERT語句
● 連接數據庫並且執行SQL語句
● 如果添加成功
● 把成功或失敗的通知返回給客戶(如果有必要
從現在開始
[WebMethod]
public int AddEvent(String eventName
String eventAttendees
{
}
下面聲明訪問數據庫
[WebMethod]
public int AddEvent(String eventName
String eventAttendees
{
System
System
DataSet ds;
oleDbConnection
oleDbConnection
String oleDbCommand =
System
new System
oleDbConnection
oleDbConnection
int queryResult = insertCommand
}
如以前一樣
[WebMethod]
public int AddEvent(String eventName
String eventAttendees
{
int queryResult = insertCommand
if (queryResult ==
{
daEvents = new System
[
From:http://tw.wingwit.com/Article/program/net/201311/14591.html