public string[] GetCompletionList(string prefixText, int count)
{
List<string> suggestions=new List<string>();//声明一泛型集合
SqlConnection con = new SqlConnection("Server=(local);Database=bookshop;Integrated Security =true;");
con.Open();
SqlCommand com = new SqlCommand("select 书名 from books where 书名 like @prefixname+'%' order by 书名", con);
com.Parameters.Add("@prefixname", SqlDbType.NVarChar).Value = prefixText ;
SqlDataReader sdr = com.ExecuteReader();
while (sdr.Read())
{
suggestions.Add(sdr.GetString(0));
}
con.Close();
return suggestions.ToArray();
}