using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager .ConnectionStrings["ConnectionString1"].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { //string cmdText = "select ContactName from Customers where " + //"ContactName like @SearchText + '%'"; string cmdText = "select MSupplier.pcode,MSupplier.pdesc from MM_Pomast inner join MSupplier on MSupplier.pcode=MM_Pomast.pcode " + " where MSupplier.loccode='" + loccode + "' And MSupplier.divcode='" + divcode + "' And MSupplier.clicode='" + clicode + "'" + " and pdesc like '%'+@prefixText+'%'"; cmd.Parameters.AddWithValue("@prefixText", prefixText); if (contextKey != null) { cmdText += " and MM_Pomast.pordcode = @contextKey"; cmd.Parameters.AddWithValue("@contextKey", contextKey); } cmd.CommandText = cmdText; cmd.Connection = conn; conn.Open(); List<string> customers = new List<string>(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { customers.Add(sdr["pdesc"].ToString()); } } conn.Close(); return customers; }
function SetContextKey() { $find('AutoCompleteExtender1').set_contextKey($get("<%=Drppordcode.ClientID %>").value); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)