我有一个文本框,我已将 AJAX AutocompleteExtender 添加到此.. 代码如下.. 来自:
并且是我添加的 CS 文件文件
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
string connString = ConfigurationManager.ConnectionStrings["Station"].ToString();
string selectString = "SELECT *from Station";
List<String> CustList = new List<string>(count);
using (SqlConnection sqlConn = new SqlConnection(connString))
{
sqlConn.Open();
using (SqlCommand sqlCmd = new SqlCommand(selectString, sqlConn))
{
SqlDataReader reader = sqlCmd.ExecuteReader();
while (reader.Read())
CustList.Add(reader["DBRT"].ToString());//DBRT is the Column name
}
}
return (CustList.ToArray());
}
当我执行代码并输入时,我输入时它没有显示任何内容。我的代码有什么问题..