using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
/// <summary>
/// Search 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class Search : System.Web.Services.WebService {

    public Search () {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string[] SearchList(string prefixText)
    {
        List<string> items=new List<string>();
        OleDbConnection conn = DB.connstr();
        conn.Open();
        string OleDb = "select book_name from book_info where book_name like '" + prefixText + "%'";
        OleDbDataAdapter sda = new OleDbDataAdapter(OleDb, conn); 
        DataTable dt = new DataTable();
        sda.Fill(dt);
        for (int i=0; i < dt.Rows.Count;i++)
        {
            
            
                items.Add(dt.Rows[i]["book_name"].ToString());
       
        }

        conn.Close();
        return items.ToArray();
    
    }
}

