Friday, September 5, 2008

Ajax Auto complete Extender webservice

Sample Code in the Webservice

public String[] FillList(string prefixText, int count)
{
SqlCommand cmd = new SqlCommand("select distinct BugTitle from bugmaster where bugtitle like '" + prefixText.Replace("'", "''") + "%'", new clsGroConnection().getOpenCon());
SqlDataAdapter da = new SqlDataAdapter(cmd);
int nn_itmCount;
DataTable dt=new DataTable("renju");
da.Fill(dt);
ArrayList arr = new ArrayList();
for (nn_itmCount = 0; nn_itmCount < ((dt.Rows.Count >= 100) ? 10 : dt.Rows.Count); nn_itmCount++)
{
arr.Add(dt.Rows[nn_itmCount]["BugTitle"]);
}
return (String[])arr.ToArray(typeof(string));
}

2 comments:

Anonymous said...

avante oru silverlight.. :)

Anonymous said...

Visit http://www.foosms.com for sending free sms.. :)