Beispiel #1
0
    public string[] GetAutoCompleteResult(string prefixText,int count)
    {
        DataAccess access = new DataAccess();
        //得到查询结果集中的DataTable
        DataTable table = access.AutoCompleteSelect(prefixText, count).Tables[0];

        //声明接收查询结果集结果的字符串数组
        string[] resultArr = new string[table.Rows.Count];
        for (int i = 0; i < table.Rows.Count;i++ )
        {
            DataRow row = table.Rows[i];
            //将结果集中的结果导入至字符串数组中
            resultArr.SetValue(row["MovieName"].ToString(),i);
        }

        return resultArr;
    }