Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create an autocomplete textbox which procedure possessed three parameters, namely the textbox / parameter field, select query, and connection?
so far I am using ajax auto complete, but the parameter field (prefixText) it can not be replaced..
C#
public static List<string> GetNama(string prefixText)
   {
       SqlConnection conn = new SqlConnection(connStr);
       conn.Open();
       SqlCommand cmd = new SqlCommand("select * from report where nama like @nama+'%' or report_id like @report_id+'%'", conn);
       cmd.Parameters.AddWithValue("@nama", prefixText);
       cmd.Parameters.AddWithValue("@report_id", prefixText);

       List<string> ReportNama = new List<string>();
       using (SqlDataReader sdr = cmd.ExecuteReader())
       {
           while (sdr.Read())
           {
               ReportNama.Add(sdr[0].ToString());
               ReportNama.Add(sdr[1].ToString());
           }
       }
       return ReportNama;
   }


how to make auto complete text as I was getting on?
do not use ajax auto complete does not matter..
thanks if you can help me :)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900