<asp:TextBox ID="txtSourceSystem" runat="server" style="background-color: #3e89d7; color: #FFFFFF;"></asp:TextBox> <cc1:AutoCompleteExtender ServiceMethod="SearchCountry" MinimumPrefixLength="1" CompletionInterval="100" EnableCaching="false" CompletionSetCount="1" TargetControlID="txtSourceSystem" ID="AutoCompleteExtender1" runat="server" FirstRowSelected = "false"> </cc1:AutoCompleteExtender>
public static List<string> SearchCountry(string prefixText, int count) { // DB2Connection conn = new DB2Connection("Server=DEV4131;Database=FTEDB;UID=db2admin;PWD=db2admin;"); using (DB2Connection conn = new DB2Connection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["DB2ConnectionString"].ConnectionString; using (DB2Command cmd = new DB2Command()) { cmd.CommandText = "select JOB_NAME from FTELOG.TRANSFER where " + "JOB_NAME like @SearchText + '%'"; cmd.Parameters.Add("@SearchText", prefixText); cmd.Connection = conn; conn.Open(); List<string> country = new List<string>(); using (DB2DataReader db2dr = cmd.ExecuteReader()) { while (db2dr.Read()) { country.Add(db2dr["JOB_NAME"].ToString()); } } conn.Close(); return country; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)