<pre>[WebMethod ] public string[] GetCompletionList(string prefixText, int count) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); cn.ConnectionString = Connection; SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; prefixText = "%" + prefixText + "%"; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spName"; cmd.Parameters.AddWithValue("@iAccountId", Convert.ToInt32( Session["iAccountId"].ToString())); //Here iam getting Session["iAccountId"]=null cmd.Parameters.AddWithValue("@PrefixText", prefixText); try { cn.Open(); cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); } catch { } finally { cn.Close(); } dt = ds.Tables[0]; //Then return List of string(txtItems) as result List<string> txtItems = new List<string>(); String dbValues; foreach (DataRow row in dt.Rows) { //String From DataBase(dbValues) dbValues = row["vcRemarks"].ToString(); //dbValues = dbValues.ToLowerInvariant (); txtItems.Add(dbValues); } return txtItems.ToArray(); }
[System.Web.Services.WebMethod(EnableSession = true)] public string[] autoSuggestIndiv(string prefixText, int count, string contextKey) { //your coding }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)