[WebMethod] public string[] names(string prefixText,int count,string contextKey) { string sql = "SELECT * FROM familytwo Where Name like @prefixText"; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString.ToString()); SqlDataAdapter da = new SqlDataAdapter(sql, conn); da.SelectCommand.Parameters.Add("@prefixText", System.Data.SqlDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["Name"].ToString(), i); i++; } return items; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)