我使用过AutoCompleteExtender,并创建了一个Web服务,但它无法正常工作,Code如下所示
和网络服务代码是:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoCompleteState : System.Web.Services.WebService {
ConnectionClass con = new ConnectionClass();
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] getStateList(string prefixText)
{
DataTable dt = new DataTable();
SqlDataAdapter adp=new SqlDataAdapter("Select distinct State from OPDPatients where State Like '%" + prefixText+ "%' ",con.con);
adp.Fill(dt);
adp.Dispose();
con.closeConnection();
string[] setvalues=new string[dt.Rows.Count];
int i=0;
foreach (DataRow dr in dt.Rows)
{
setvalues.SetValue(dr[0].ToString(), i);
i++;
}
return setvalues;
}
}
我无法找到错误。 Plz帮助
答案 0 :(得分:0)