Hi,
Sometimes my auto complete is working Sometimes not working. this is my code.what is problem ?
Code Behind
==========
[WebMethod]
public string[] GetCompletionList(string prefixText)
{
prefixText = prefixText.ToUpper().Trim();
List
String sConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
OleDbConnection objDBConnection = new OleDbConnection(sConnectionString);
objDBConnection.Open();
String strSelect = "select ComputerName from Pc_System_Info where UPPER(ComputerName) like '%" + prefixText + "%'";
OleDbCommand objCmd = new OleDbCommand(strSelect, objDBConnection);
OleDbDataReader dr = objCmd.ExecuteReader();
while (dr.Read())
{
items.Add(dr["ComputerName"].ToString());
}
return items.ToArray();
}
Design Time
============
MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :">
Please let me know
Thanks and Regards
Arul.P
Dusan TkacPosted Dec 15, 2008, 3:59 AM
Hi,
always close your DB connection when you are finished with reading (or update).
Number of available DB connections is limited and this way (leaving it open) you soon can be denied to connect.
Dusan